課程
/后端開發
/Python
/初識Python
總是到else就出錯
2016-05-27
源自:初識Python 5-2
正在回答
score?=?55 if?score?>=?60: ????print("a") else: ????print("b")
else應該和if對齊
星辰hh 提問者
>>> score=55
>>> if(score>=60):
...? print('passed')
... else:print('failed')
...
failed
按照你第一個格式寫,else不要打空格,直接輸入else后面加上:
socre=55
if score>=60:
??? print('passed')
else:
??? print('fuck you')
跑了一下,沒問題
頂到開頭
你縮進出問題了,而且沒加 :
else 和if需要對其,需要加 :
你是不是沒加 #coding:utf-8 ?
跟我的一樣,我的也是到else就不行
舉報
學python入門視頻教程,讓你快速入門并能編寫簡單的Python程序
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號-11 京公網安備11010802030151號
購課補貼聯系客服咨詢優惠詳情
慕課網APP您的移動學習伙伴
掃描二維碼關注慕課網微信公眾號
2016-05-27
else應該和if對齊
2020-06-11
>>> score=55
>>> if(score>=60):
...? print('passed')
... else:print('failed')
...
failed
2019-07-03
按照你第一個格式寫,else不要打空格,直接輸入else后面加上:
2017-06-19
socre=55
if score>=60:
??? print('passed')
else:
??? print('fuck you')
跑了一下,沒問題
2017-05-26
頂到開頭
2017-01-05
你縮進出問題了,而且沒加 :
else 和if需要對其,需要加 :
2016-08-30
你是不是沒加 #coding:utf-8 ?
2016-08-09
跟我的一樣,我的也是到else就不行