How do i create a tipping program for python? -


i new programming , learning python book purchased. @ end of each chapter has challenges write programs based on have learnt in previous chapter.it asking create program user enter amount restaurant bill , tells them 2 amounts 15% , 20% tip has not discussed in book how work out percentages in python. have tried looking online , nothing shows regarding this. sure simple don't won't carry on further book before understanding this.

how this:

# input prompt user bill amount @ command line amount = float(input('enter amount of bill: '))  tip_15 = amount * .15 tip_20 = amount * 0.2  print('a 15%% tip is: %.2f. 15%% tip is: %.2f.' % (tip_15, tip_20))  print('total price 15%% tip is: %.2f' % (amount + tip_15)) print('total price 20%% tip is: %.2f' % (amount + tip_20)) 

Comments

Popular posts from this blog

node.js - Bad Request - node js ajax post -

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -