摘要:
score = int(input('分数: ')) if score >= 60 and score = 90: print('优秀') else: print('你要努力了') 输出: 阅读全文
posted @ 2019-05-13 16:35
hejp
阅读(151)
评论(0)
推荐(0)
摘要:
score = int(input('分数: ')) if score >= 90: print('优秀') elif score >= 80: print('好') elif score >= 70: print('良') elif score >= 60: print('及格') else: print('你要努力了') 输出: 阅读全文
posted @ 2019-05-13 16:32
hejp
阅读(191)
评论(0)
推荐(0)
摘要:
import random num = random.randint(1,10) # 随机生成1-10之间的数字。 answer = int(input('guess a number: ')) # 将用户输入的字符转成整数。 if answer > num: print('猜大了') elif answer < num: print('猜小了') else: pri... 阅读全文
posted @ 2019-05-13 15:41
hejp
阅读(104)
评论(0)
推荐(0)
摘要:
import getpass # 导入模块 username = input('username: ') # getpass模块中,有一个方法也叫getpass password = getpass.getpass('password: ') if username == 'bob' and password == '123456': print('Login successful... 阅读全文
posted @ 2019-05-13 15:34
hejp
阅读(519)
评论(0)
推荐(0)
摘要:
a = 10 b = 20 if a < b: smaller = a else: smaller = b print(smaller) s = a if a < b else b # 和上面的if-else语句等价的。 print(s) 输出: 阅读全文
posted @ 2019-05-13 14:58
hejp
阅读(235)
评论(0)
推荐(0)