第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

函數(shù)中的積分變量不起作用

函數(shù)中的積分變量不起作用

開滿天機(jī) 2021-06-06 21:32:51
我正在嘗試使第一個(gè)函數(shù) opt1() 使健康下降 50 點(diǎn),但是由于某種原因它不起作用。該代碼在不在函數(shù)中時(shí)有效。不起作用的行: health = int(health) - 50import randomhealth = "100"p = "1"def opt1():   print("Du f?rlorade striden")   health = int(health) - 50   print(health)def opt2():   print("hej2")def opt3():   print("hej3")q = [opt1, opt2, opt3]ind = random.randint(0,len(q)-1)print("you have ", p, " potions")print("Your health is ", health,)while True:   print("Commands: Add, drink, sleep, fight, quest")   a = input("Enter a command: ")   if a == "add":       health = int(health)       p = int(p) + 1       print("you have ", p, " potions")       print("Your health is ", health,)   if a == "fight":       q[ind]()
查看完整描述

2 回答

?
猛跑小豬

TA貢獻(xiàn)1858條經(jīng)驗(yàn) 獲得超8個(gè)贊

def opt1():

在 opt1 中,您應(yīng)該聲明您提供給函數(shù)的變量。

例如:

def opt1(health):


查看完整回答
反對 回復(fù) 2021-06-16
  • 2 回答
  • 0 關(guān)注
  • 196 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號