Below is a program to compute the net run rate of given number of matches.
teamName = input("Enter the name of Team : ")
totalMatches = int(input("Enter the number of matches played : "))
totalRun = 0 # to hold total runs
totalOvers = 0 # to hold total overs
if totalMatches > 5:
print("You can enter Maximum 5 matches")
else:
for i in range(totalMatches):
runs = int(input("Enter the number of run scorred in match " + str(i + 1) + ": "))
overs = int(input("Enter the number of overs " + str(i + 1) + ": "))
totalRun = totalRun + runs
totalOvers = totalOvers + overs
#computing net run rate only for max 5 matches
if totalMatches <= 5:
netRunRate = 0
netRunRate = int(totalRun / totalOvers)
print("Congrats " + teamName + " your net run rate is: " + str(netRunRate))
Output:
- Python tutorials
- Input and Output in Python
- f-strings in Python
- end and sep in Python
- Python QuickStart
- Variables in Python
- Data Types in Python
- Operators in Python
- Python program to compute net run rate
- Python program to get biggest number
- Python program to count the frequency of every element
- Python program of list and swap its content
- Python program to get max numbers
- Python program to generate patterns
- Python Program to Check ArmstrongÂ
- Python program to print multiplication table
- Python program for domestic electricity billÂ
- Python program to find maximum numberÂ
- Python program to check uppercase or lowercase letterÂ