Nov-01-2018, 11:25 PM
I'm trying to create a system where different random numbers will display depending on the number generated.
I don't know what I've done wrong and what I need to do to fix it. Can anyone tell me what ive done wrong?
[python]
compnum = random.randint(1,40)
if compnum <6:
compnum = random.randint(8,14)
print("my number was",compnum,"\n")
elif compnum >= 6 and <35: <<this is the line that wont work(syntax error)
compnum = random.randint(14,18)
print("my number was",compnum,"\n")
elif compnum >= 35 and <41:
compnum = random.randint(18,21)
print("my number was",compnum,"\n")
[python]
I don't know what I've done wrong and what I need to do to fix it. Can anyone tell me what ive done wrong?
[python]
compnum = random.randint(1,40)
if compnum <6:
compnum = random.randint(8,14)
print("my number was",compnum,"\n")
elif compnum >= 6 and <35: <<this is the line that wont work(syntax error)
compnum = random.randint(14,18)
print("my number was",compnum,"\n")
elif compnum >= 35 and <41:
compnum = random.randint(18,21)
print("my number was",compnum,"\n")
[python]