import random
import time
print ("Welcome to the Iles lottery chaps. Where todays jackpot is a whopping 354,000,000!")
time.sleep (1)
print (" All i need you to do is pick 5 numbers for me (between 1 and 49) ")
number_1 = input (" Please pick your first number")
number_2 = input (" Please pick your second number")
number_3 = input (" Please pick your third number")
number_4 = input (" Please pick your fourth number")
number_5 = input (" Please pick your fifth and final number")
time.sleep(1)
print (" Thanks, now lets get onto picking the numbers")
time.sleep (2)
#---------------------------This section is the part that asks the user their number-------------------
higher_value = 49
lower_value = 1
final_value = random.randint(lower_value, higher_value)
print(final_value)
time.sleep (2)
higher_value2 = 49
lower_value2 = 1
final_value2 = random.randint(lower_value2, higher_value2)
print(final_value2)
time.sleep(2)
higher_value3 = 49
lower_value3 = 1
final_value3 = random.randint(lower_value3, higher_value3)
print(final_value3)
time.sleep(2)
higher_value4 = 49
lower_value4 = 1
final_value4 = random.randint(lower_value4, higher_value4)
print(final_value4)
time.sleep(2)
higher_value5 = 49
lower_value5 = 1
final_value5 = random.randint(lower_value5, higher_value5)
print(final_value5)
time.sleep(3)
#----------------------------This section is the part that randomly selects the numbers, and outputs them--------------
print (" To recap, our 5 lucky numbers are....")
print (final_value, final_value2, final_value3, final_value4, final_value5)
if (number_1) (number_2) (number_3) (number_4) (number_5) == (final_value) (final_value2) (final_value3) (final_value4) (final_value5):2
print (" You just won £354,000,000")
else:
print (" I'm very sorry, but you didn't match all the numbers :(. If you matched 4/5 then you've just learnt why the Iles Lottery is so unpopular.. You don't win any money unless you match every number. HAH!")
-3
A
回答
0
(number_1) (number_2)
相當於number_1(number_2)
:它試圖把number_1
的功能,並與number_2
作爲參數調用它。你想要:
if (number_1, number_2, number_3) == (final_value, final_value2, final_value3):
(也與4和5)。
+0
非常感謝球員:) –
0
試試這個代碼:
import random
import time
print ("Welcome to the Iles lottery chaps. Where todays jackpot is a whopping 354,000,000!")
time.sleep (1)
print (" All i need you to do is pick 5 numbers for me (between 1 and 49) ")
number_1 = input (" Please pick your first number")
number_2 = input (" Please pick your second number")
number_3 = input (" Please pick your third number")
number_4 = input (" Please pick your fourth number")
number_5 = input (" Please pick your fifth and final number")
time.sleep(1)
print (" Thanks, now lets get onto picking the numbers")
time.sleep (2)
#---------------------------This section is the part that asks the user their number-------------------
higher_value = 49
lower_value = 1
final_value = random.randint(lower_value, higher_value)
print(final_value)
time.sleep (2)
higher_value2 = 49
lower_value2 = 1
final_value2 = random.randint(lower_value2, higher_value2)
print(final_value2)
time.sleep(2)
higher_value3 = 49
lower_value3 = 1
final_value3 = random.randint(lower_value3, higher_value3)
print(final_value3)
time.sleep(2)
higher_value4 = 49
lower_value4 = 1
final_value4 = random.randint(lower_value4, higher_value4)
print(final_value4)
time.sleep(2)
higher_value5 = 49
lower_value5 = 1
final_value5 = random.randint(lower_value5, higher_value5)
print(final_value5)
time.sleep(3)
#----------------------------This section is the part that randomly selects the numbers, and outputs them--------------
print (" To recap, our 5 lucky numbers are....")
print (final_value, final_value2, final_value3, final_value4, final_value5)
if (number_1, number_2, number_3, number_4, number_5) == (final_value, final_value2, final_value3, final_value4, final_value5):
print (" You just won £354,000,000")
else:
print (" I'm very sorry, but you didn't match all the numbers :(. If you matched 4/5 then you've just learnt why the Iles Lottery is so unpopular.. You don't win any money unless you match every number. HAH!")
相關問題
- 1. 類型錯誤:浮動不可回叫
- 2. JavaScript中的錯誤例外。類型錯誤呼叫不是功能
- 3. 類型錯誤:STR對象是不可調用的
- 4. 類型錯誤: 'STR' 對象不是可調用(Python)的
- 5. 類型的呼叫
- 6. 錯誤「類型錯誤:必須str的不是int」
- 7. pygame.rect是不可呼叫
- 8. 類型錯誤:unorderable類型:STR()<INT()
- 9. 錯誤呼叫在
- 10. GraphQL錯誤: '的instanceof' 的右手邊是不可呼叫
- 11. 錯誤嘗試呼叫PHP類
- 12. 呼叫按數據類型
- 13. Python的類型錯誤:不支持的操作類型爲 - :「STR」和「STR」
- 14. jQuery AJAX呼叫 - 是否可以取消不需要的呼叫?
- 15. 類型錯誤:STR對象不可調用的Python代碼
- 16. python GUI類型錯誤:'str'對象不可調用
- 17. 錯誤在Python:類型錯誤:unorderable類型:STR()<int()函數
- 18. 類型錯誤導致的Django錯誤:必須是unicode不是str
- 19. 類型錯誤:不支持的操作類型NoneType和STR
- 20. 只能連接列表(不是「str」)到列表 - 類型錯誤
- 21. 類型錯誤:只能拼接元組(而不是「STR」)
- 22. 類型錯誤:%d格式:需要數量,而不是str的
- 23. 類型聲明文件和呼叫簽名錯誤
- 24. C++模板錯誤:呼叫
- 25. 未解決呼叫錯誤
- 26. 呼叫轉移錯誤
- 27. Rg.Plugin.PopupPage錯誤與呼叫線
- 28. 肥皂呼叫錯誤
- 29. 呼叫Dialog.Modal有錯誤
- 30. 「不匹配功能呼叫」錯誤
整個程序正常工作,但其剛剛當我得到的「如果」的一部分,它說「str是不可調用的」 –