Python 02
2017-12-06 本文已影响0人
Jack_Hsin
一. 课上代码
temp = input("Guess a number:")
guess = int(temp)
if guess == 8:
print("Your answer is correct!")
else:
print("Oops, the right answer is 8!")
print("Game over!")
二. 动动手答案
- 编写程序,要求用户输入姓名并打印“你好,姓名!”
str1 = input("Input your name:")
print("Hello " + str1 + "!")
- 编写程序,要求用户输入1到100之间数字并判断,输入符合要求打印“你妹好漂亮”,不符合要求打印“***”
num = int(input("Please input a number between 1 and 100:"))
if num == 88:
print("Your sister is pretty!")
else:
print("WTF!")