import random num = random.randint(1, 10)running = True while running:an...
import random all_choices = ['石頭', '剪刀', '布']win_list = [['石頭', '剪刀'], [...
import random all_choices = ['石頭', '剪刀', '布']computer = random.choice(al...
score = int(input('分數: ')) if score >= 60 and score < 70:print('及格')elif...
score = int(input('分數: ')) if score >= 90:print('優(yōu)秀')elif score >= 80:pr...
import random num = random.randint(1, 10) # 隨機生成1-10之間的數字answer = int(in...
import getpass # 導入模塊 username = input('username: ') getpass模塊中,有一個方法也叫...
a = 10b = 20 if a < b:smaller = aelse:smaller = b print(smaller) s = a i...
單個的數據也可作為判斷條件。任何值為0的數字、空對象都是False,任何非0數字、非空對象都是True。if 3 > 0:print('yes'...