Write a program that asks for the name and number of points scored by two basketball players.
Question
Write a program that asks for the name and number of points scored by two basketball players.
Solution
Sure, here is a simple Python program that does that:
# Ask for the name and number of points scored by the first player
player1 = input("Enter the name of the first player: ")
points1 = int(input("Enter the number of points scored by the first player: "))
# Ask for the name and number of points scored by the second player
player2 = input("Enter the name of the second player: ")
points2 = int(input("Enter the number of points scored by the second player: "))
# Print the results
print(player1 + " scored " + str(points1) + " points.")
print(player2 + " scored " + str(points2) + " points.")
This program first asks for the name and number of points of the first player, then does the same for the second player. It then prints out the results. The input
function is used to get user input, and int
is used to convert the points from strings to integers.
Similar Questions
________________ is a team sport with two teams of five players each try to score by shooting a ball through a hoop elevated 10 feet above the ground.
: The points scored by a basketball team in a series of matches are follows: 17, 7, 10, 25, 5, 10, 18, 10 and 24. Find the range
What is the primary objective of passing in basketball?a) To score points b) To create opportunities for teammatesc) To dribble the ball
.Write a Python program to store marks scored in subject “Fundamental of DataStructure” by N students in the class and perform different operations.
create a structure name teams in the attribute team names and n scores. sort the scores in ascending order
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.