首页 > 其他 > 详细

2.5计算小费.py

时间:2018-04-22 18:02:29      阅读:209      评论:0      收藏:0      [点我收藏+]
# -*- 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

原文:https://www.cnblogs.com/Wang-Y/p/8908302.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!