write a program to display whether the batsmen has scored century or half century in python
Answers
Answer:
Here is a simple Python program that takes in the number of runs scored by a batsman and checks if it is a century or a half-century:
runs_scored = int(input("Enter the number of runs scored by the batsman: "))
if runs_scored >= 100:
print("Century scored!")
elif runs_scored >= 50:
print("Half-century scored!")
else:
print("Less than half-century scored.")
Explanation:
In this program, the input function is used to take in the number of runs scored by the batsman as an integer. The if-elif-else block is used to check if the runs scored are greater than or equal to 100, in which case it is a century, or greater than or equal to 50, in which case it is a half-century. If the runs scored are less than 50, the program prints "Less than half-century scored." This code could be used to check the performance of a batsman in a cricket match.
More questions and answers
https://brainly.in/question/39236789
https://brainly.in/question/39236721
#SPJ1