Reference no: EM132278152
Can you please Test and debug the program below using the following specifications? Many thanks!
Provide a list of valid entries and the correct results for each set of entries. Then, make sure that the results are correct when you test with these entries.
Provide a list of invalid entries. These should include entries that test the limits of the allowable values. Then, handle the invalid integers (such as negative integers and unreasonably large integers). In addition, make sure the user can't enter data that doesn't make sense (such as a player having more hits than at bats).
Don't attempt to handle invalid entries that cause exceptions, such as the user entering a string like "x" for an integer value. You can do that after you read chapter 8.
Tip: whenever needed please provide screenshots of your debugging. Thorough Test Plan also would be a BIG plus.
def display_menu():
print("+"*50)
print(" ttBaseball Team Manager")
print("MENU OPTIONS")
print("1 - Calculate batting average.")
print("2 - Exit program.")
print("+"*50)
def convertBat():
print("Calculate batting average.")
num_at_bats = int(input("Enter official number of at bats: "))
num_hits = int(input("Enter number of hits: "))
average = num_hits/num_at_bats
print("Batting average:", round(average,3))
def main():
while True:
display_menu()
rk = int(input("Menu Option : "))
if (rk == 1):
convertBat()
elif(rk == 2):
break
else:
print("Not a valid option. Please try again.")
print("Bye!")
main()