2.5計算小費.py
阿新 • • 發佈:2018-04-22
val spa put created eva reat __name__ () style
# -*- coding: utf-8 -*- """ Created on Sun Apr 22 16:27:37 2018 @author: MyPC """ def main(): ‘‘‘ 計算小費. 公式: gratuity = subtotal * gratuity_rate total = gratuity + subtotal input:subtotal, gratuity_rate output:gratuity, total ‘‘‘ subtotal, gratuity_rate= eval(input("input subtotal, gratuity_rate:")) gratuity = subtotal * (gratuity_rate / 100) total = gratuity + subtotal print("The gratuity is %.2f and the total is %.2f :"%(gratuity, total)) if __name__ == "__main__": main()
2.5計算小費.py