x=int(input(1))
y=int(input(2))
if x==y:
print('x and y are equal')
else:
print('x and y are not equal')
print('thanks')
-3
A
回答
1
首先,您可以在任何教程,書籍或在此處搜索的問題中找到此信息。無論如何......
輸入將在控制檯中提示時顯示將顯示給用戶的文本。
>>> input("Enter a number: ")
Enter a number:
然後,我可以輸入我想要的數字並按回車。 (回到上一行)
Enter a number: 4
然後,您分配輸入的值將有「4」。請注意,這是一個字符串。
因此,int(input(1))
沒有做你認爲的事情。您的程序仍在「運行」,因爲它正在等待用戶輸入。
x=int(input("Enter first number: "))
y=int(input("Enter second number: "))
if x==y:
print('x and y are equal')
else:
print('x and y are not equal')
print('thanks')
輸出:
Enter first number: 1
Enter second number: 1
x and y are equal
thanks
0
它繼續運行,因爲x和y是輸入。輸入要求你輸入一些東西給他們一個價值。刪除輸入(...)。另外,int()是不必要的,因爲1和2已經是整數。
x = 1
y = 2
if x == y:
print("x and y are equal")
else:
print("x and y are not equal")
print("thanks")
0
您好Nitesh先生,當你執行你的計劃也得到輸出,但編程或標準的方式
你的程序是沒有錯的無效程序。
如果你是初學Python的人,首先閱讀深層次的基本編程和閱讀編程標準。我給下面的網站蟒蛇... 1)http://docs.ckan.org/en/latest/contributing/python.html(Python編程標準)
2)https://www.tutorialspoint.com/python/(Python的學習)
3)https://docs.python.org/3/tutorial/(Python的學習)
我給你的答案的問題是下面,
x = int(input("Enter the value of x: "))
y = int(input("Enter the value of Y: "))
print "Now check both are equal or not..."
if x != y:
print('x and y are not equal.')
elif x == y :`enter code here`
print('x and y are equal')
print('Thank you.')
+0
尼斯。我是新來的蟒蛇我學習所有網站給你。 –
相關問題
- 1. 我的錯誤在哪裏?
- 2. 我的錯誤在哪裏?
- 3. Python:線程仍在運行
- 4. 我的HTTP表單登錄程序中的錯誤在哪裏?
- 5. 我的rails應用程序中的語法錯誤在哪裏?
- 6. 此編程正在編譯但未運行。錯誤在哪裏?
- 7. 我在哪裏運行ioic serve錯誤消息@ ionic/cli-utils/bootstrap'
- 8. 我的語法錯誤在哪裏?
- 9. 我查詢中的錯誤在哪裏?
- 10. Django/Python:UnboundLocalError。我的錯誤在哪裏?
- 11. 我的錯誤LUA在哪裏?
- 12. 我的DI錯誤在哪裏?
- 13. 我的分段錯誤在哪裏?
- 14. 我收到錯誤不幸的應用程序已停止。錯誤在哪裏?
- 15. 我的Python腳本中的錯誤在哪裏?
- 16. Python - 我的MySQL查詢中的錯誤在哪裏?
- 17. 錯誤在哪裏?
- 18. 錯誤在哪裏?
- 19. 在Ubuntu上的devil .so我在哪裏把它們 - 運行時錯誤
- 20. 我的應用程序在哪裏
- 21. 我的Microsoft.Windows.Themes程序集在哪裏?
- 22. 在哪裏託管我的servlet程序...?
- 23. 我的程序輸出在哪裏?
- 24. 我的Android應用程序在哪裏?
- 25. 我的錯在哪裏
- 26. 我的錯在哪裏?
- 27. 我應該在哪裏開始用「分段錯誤:11」來調試python程序
- 28. Python - 嵌套字典。錯誤在哪裏?
- 29. Python語法錯誤在哪裏?
- 30. Java - 運行我的java程序錯誤
看起來錯誤不是來自程序本身,它沒有任何問題。 –
你真的想用'1'和'2'作爲輸入提示嗎?否則該程序似乎工作 –