Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def total_or_average():
- input_set = []
- how_many = input("How many numbers do you want to " + command + "? ")
- howmany = int(how_many)
- total = 0
- for number_count in range(howmany):
- number = input("Enter number " + str(number_count + 1) + "> ")
- input_set.append(number)
- total = total + int(number)
- average = total / howmany
- if command == "total":
- result = total
- elif command == "average":
- result = average
- print("the " +command+ " of" + str(input_set) + " is " + str(result))
Advertisement
Add Comment
Please, Sign In to add comment