用PythonCharm編寫乙個猜年齡的小遊戲

2021-10-11 02:10:39 字數 445 閱讀 1155

import random #把random模組呼叫出來

age = random.randint(10,25)#用rand.randint製造乙個隨機數表

count = 0

while count < 3:#共有三次機會

n = int(input(『guess the age:』))#輸入使用者通過鍵盤敲打的資料

if n > age:

print(『try smaller,你還有%s次機會』%(2-count))

count += 1

elif n < age:

print(『try bigger,你還有%s次機會』%(2 - count))

count += 1

else:

print(『yes,you get it』)

break#結束迴圈

print(age)

robotframework編寫用例

1 test cases 2test with settings 3 documentation another dummy test4 用於指定測試用例文件 5 tags dummy owner johnoe6 用於指定測試用例標籤 7 template 8 用於指定測試模板,測試用例本身將只包含...

用CodeBlocks OpenMP編寫並行程式

參考這篇博文 步驟 2.配置編譯器,在selected compiler選項中選gnu gcc compiler 3.填寫編譯引數,compiler setting裡的other options中貼上 fopenmp 4.填寫連線引數,link setting裡的other options中貼上 l...

用Objective C編寫乙個終端應用

在main函式中,必須建立乙個autorelease pool,objective c用它來管理記憶體。編譯 用的是clang命令,它的一些選項有 fobjc objective c是使用的程式語言 arc automatic reference counting framework 鏈結到foun...