类型错误str不可调用

时间:2016-11-06 12:27:57

标签: python

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!")

2 个答案:

答案 0 :(得分:0)

MKIMAGEOUTPUT_target等同于 WITH Ids (id) as ( SELECT DISTINCT id FROM A ) SELECT Ids.id, (select sub.value from A sub where Ids.id=sub.id and sub.code=1 fetch first rows only) Code1_Val, (select sub.value from A sub where Ids.id=sub.id and sub.code=2 fetch first rows only) Code2_Val, (select sub.value from A sub where Ids.id=sub.id and sub.code=3 fetch first rows only) Code3_Val FROM Ids :它会尝试将(number_1 ) (number_2 )视为一个函数,并以number_1(number_2)作为参数调用它。你想要:

number_1

(也有4和5)。

答案 1 :(得分: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!")