您好,登錄后才能下訂單哦!
input()函數用于讀取標準輸入
注意:input函數的返回值類型為字符串
>>> num=input("Please input a number:")
Please input a number:32
>>> type(num)
<class 'str'>
>>> num1=input("Please input the number1:")
Please input the number1:5
>>> num2=input("Please input the number2:")
>>> print("number1 + number2 =",(num1+num2))
number1 + number2 = 53
>>> print("number1 + number2 =",(int(num1)+int(num2)))
number1 + number2 = 8
>>> cus=input("Please input the custom name:")
Please input the custom name:Tom
>>> cid=input("Please input the custom ID:")
Please input the custom ID:001
>>> cus_info='''
custom_name:{0}
custom_id:{1}
'''.format(cus,cid)
>>> print(cus_info)
custom_name:Tom
custom_id:001
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。