亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
score = {}
if score > 18:
print('adult')
else:
print('teenager')
結果是 adult,求解惑

最贊回答 / 慕少0598786
因為你寫錯了a=0b=0while True:? ? if a > 1000:? ? ? ? break? ? if a % 2 == 0:? ? ? ? b=b+a? ? a=a+1print(b)?這樣才對
l=[75,92,59,68,99]
sum=0
a=0
for i in l:
if i is not None:
sum=eval("sum + i")
a=eval("a+1")

else:
break
b=eval("sum/a")
print("總值是:",sum)
print("一共有",a,"個值")
print("平均值為:",b)
a=int(input("請輸入您的年齡:"))
if a >=18:
print("adult")
elif a <18 and a > 6:
print("teenager")
elif a >=3 and a<=6:
print("kid")
else:
print("baby")
你這節課超綱了吧。。。。。

最新回答 / weixin_慕婉清0361474
你這if的判斷條件,跳過的是偶數

已采納回答 / weibo_東匚酆筤_0
可以記一下,后續再邏輯開發的過程中會經常出現,當然不需要死記硬背,以后用的多了自然而然的也就記住了
template = '{}'
result1 = template.format('Life is short, you need Python')
print(result1)

temp = 'Life is short, {}'
result2 = temp.format('you need Python')
print(result2)

tmp = "{0} {1} {2}, {3} {4} {5}"
result3 = tmp.format('Life','is','short','you','need','Python')
print(result3)
print(r"""'\"To be, or not to be\": that is the question.\nWheth
er it\'s nobler in the mind to suffer.'""")
print("special string: '")
print("\"")
print("\\")
print("\\\\")
print("\\n")
print("\\t")
python3.x中cmp函數去掉了,如果需要實現比較功能,那么可引入operator 模塊 import operator
print(operator.lt(3,4) ==>True

已采納回答 / liakin
直接用5 / 3的話會被認為是整數類型的運算,最后結果會輸出整數類型,用5.0 / 3.0即可
L = ['Alice', 'Bob', 'Candy', 'David', 'Ellena']
name1 = L.pop(2)
name2 = L.pop(2)
print(L)

最新回答 / 天堂沒有神
template1 = 'Life is {},'template2 = 'you need {a}'k423 = 'python'print(template1.format('short'),template2.format(a=k423))這樣就可以

最新回答 / qq_慕工程7590247
result = template.format(w=w , c=c , b=b, i=i )這一行要這樣寫,w=w,第一個w指template = 'Hello {w}, Hello {c}, Hello , Hello {i}.'這里定義的形參,第二個指 w = 'World'這里定義的實參學了函數就知道了這個報錯就是編譯器找不到你定義的實參
課程須知
如果您了解程序設計的基本概念,會簡單使用命令行,了解中學數學函數的概念,那么對課程學習會有很大的幫助,讓您學起來得心應手,快速進入Python世界。
老師告訴你能學到什么?
通過本課程的學習,您將學會搭建基本的Python開發環境,以函數為基礎編寫完整的Python代碼,熟練掌握Python的基本數據類型以及list和dict的操作,靈活使用流程控制語句。

微信掃碼,參與3人拼團

微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號

友情提示:

您好,此課程屬于遷移課程,您已購買該課程,無需重復購買,感謝您對慕課網的支持!

本次提問將花費2個積分

你的積分不足,無法發表

為什么扣積分?

本次提問將花費2個積分

繼續發表請點擊 "確定"

為什么扣積分?

舉報

0/150
提交
取消