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)) 
Python program to compute net run rate

Output:

Python program to compute net run rate

Explore More

Python tutorials

We are starting a Python Tutorials Series for Beginners and Professionals. In these Python Tutorials, we will cover all the features of Python. You will learn from basic to advanced-level features

f-strings in Python

Python offers a powerful feature called f-strings (formatted string literals) to simplify string formatting and interpolation. f-strings is introduced in Python 3.6 it provides a concise and intuitive way to embed expressions and variables

Input and Output in Python

Understanding input and output operations is fundamental to Python programming. With the print() function, you can display output in various formats, when the input() function/method enables interaction with users by gathering