• 作业--用户输入数字0-100,判断成绩,用函数


     
     1 #作业
     2 # 作业:
     3 # 用户输入数字0-100
     4 # 程序判断:
     5 # 数字>90,成绩为A
     6 # 数字>80,成绩为B
     7 # 数字>70,成绩为C
     8 # 数字<60,成绩为D
     9 # 尝试用函数完成?
    10 
    11 def score(name):
    12     print("welcome to %s".center(50,"-")%(name.upper()))
    13 
    14     while True:
    15         choice = input("please your input score or exit q : ")
    16 
    17         if choice == "q": exit()
    18         if choice.isdigit():
    19             choice = int(choice)
    20             if choice > 100:
    21                 print("请输入0-100以内的数字")
    22                 continue
    23             if choice == 100:
    24                 print("%s score is Full Score
    " %(name))
    25             elif choice >= 90:
    26                 print("%s score is A
    "%name)
    27             elif choice >= 80:
    28                 print("%s score is B
    "%name)
    29             elif choice >= 60:
    30                 print("%s score is C
    "%name)
    31             else:
    32                 print("%s score is D
    "%name)
    33 
    34 
    35         else:
    36             print("请输入0-100以内的数字")
    37             continue
    38 
    39 name = input("please your input name: ")
    40 score(name)
  • 相关阅读:
    HRBUST--2317 Game(完全背包)
    k8s的回滚应用
    python练习-2
    k8s HA 补充-(keepalived+haproxy配置)
    Etcd故障恢复记录
    kubernetes 1.14安装部署helm插件
    k8s Prometheus+CAdvisor+node_export+grafana
    k8s ingress部署
    k8s pvc
    k8s pv
  • 原文地址:https://www.cnblogs.com/gaoyuan111/p/6816052.html
Copyright © 2020-2023  润新知