python使用sys模塊
提問人:楊紫紅發(fā)布時(shí)間:2020-11-18
sys模塊內(nèi)部有一個(gè)特殊的對(duì)象稱為stdin(標(biāo)準(zhǔn)輸入),它提供了一個(gè)相當(dāng)有用的函數(shù)readline。ReadLine函數(shù)用于讀取一行文本類型在鍵盤上,直到按回車鍵。
import sys
def ageEV():
print('How old are you?')
age = int(sys.stdin.readline())
if age <= 15:
print('you are a child!')
elif age >15 and age<40:
print('you are a young!')
else:
print('you are old!')
ageEV()
繼續(xù)查找其他問題的答案?
相關(guān)視頻回答
點(diǎn)擊加載更多評(píng)論>>