Created
January 18, 2020 00:46
-
-
Save yosefsadek/8764cb9bde14c9a7388c3c49187726dd to your computer and use it in GitHub Desktop.
py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
print ('eserve a souvenir of the train') | |
#asks the user to input the number of adults and stores it in the adults variable | |
adults = input("Enter the number of adults: ") | |
#asks the user to input the number of children and stores it in the children variable | |
children = input("Enter the number of children: ") | |
#works out the adult cost by multiplying the number of adults by £5 and storing it in adult total | |
adulttotal = int(adults) * 5 | |
#works out the child cost by multiplying the number of children by £3 and storing it in child total | |
childtotal = int(children) * 3 | |
#works out the grand total by adding the adult total to the child total | |
grandtotal = adulttotal + childtotal | |
#displays the cost for the number of adults and number of children | |
print(adults + " adults and " + children + " children will cost a total of £{:.2f}".format(grandtotal)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment