Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- print("Hi, I am Emi, your personal bot.")
- your_name = input("What is your name?")
- print("Welcome, " + your_name + ".")
- command = input(
- "Which do you want to know, the total or the average age of your families? Type 'add' or 'ave'."
- )
- if command == "add":
- how_many = input("How many people in your family?> ")
- how_many = int(how_many)
- total = 0
- for number_count in range(how_many):
- number = input("Enter the age " + str(number_count) + "> ")
- total = total + int(number)
- result = total
- print("the total age = " + str(result))
- elif command == "ave":
- how_many = input("How many people in your family?> ")
- how_many = int(how_many)
- total = 0
- for number_count in range(how_many):
- number = input("Enter the age " + str(number_count) + "> ")
- total = total + int(number)
- result = total / how_many
- print("the average age = " + str(result))
- else:
- print("Sorry I don't understand.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement