Skip to content

Instantly share code, notes, and snippets.

@yosefsadek
Created January 18, 2020 00:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yosefsadek/8764cb9bde14c9a7388c3c49187726dd to your computer and use it in GitHub Desktop.
Save yosefsadek/8764cb9bde14c9a7388c3c49187726dd to your computer and use it in GitHub Desktop.
py
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