[Python] study notes Day02 1.2 from a simple little game starts

1. Understand the BIF-Build-in function (built-in function)

View BIF, use dir (in the shell builtins ), small and medium-write function

2. Simple games

Conditional branching statements if ... else

print("第二课\n小的游戏规则")

print("--------我是weivid_wang----------")
temp = input("猜一下weivid_wang心中想的是哪个数:")
guess = int(temp)
if guess < 8:
    print ("shu")
if guess == 8:
    print("卧槽你是我心中的蛔虫吗\n哼猜中了也没有奖励!!")
else:
    print("猜错了,我心中的想的是8!!")
print("游戏结束,不玩啦!")

Run the program, enter the prompt window, we enter 5, the results are as follows:
Here Insert Picture Description
to re-run the program, a window prompts for, we input 8, the results are as follows:
Here Insert Picture Description

Published 105 original articles · won praise 71 · views 40000 +

Guess you like

Origin blog.csdn.net/vivid117/article/details/104277239