Mar-11-2019, 02:00 AM
I don't understand my error
x = random (1,5) if x % 2 == 0: print ("even") else: print ("odd")
Random function
|
Mar-11-2019, 02:00 AM
I don't understand my error
x = random (1,5) if x % 2 == 0: print ("even") else: print ("odd")
Mar-11-2019, 02:08 AM
Where are you getting rando from? If it's from the random module, you generally don't give it parameters, and it returns a float, not an int. You probably want random.randint instead.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness. Recommended Tutorials: BBCode, functions, classes, text adventures |
|
Possibly Related Threads… | |||||
Thread | Author | Replies | Views | Last Post | |
Noob here. Random quiz program. Using a while loop function and alot of conditionals. | monkeydesu | 6 | 3,639 |
Sep-07-2022, 02:01 AM Last Post: kaega2 |
|
basic random number generator in replace function | krug123 | 2 | 2,832 |
Jul-31-2020, 01:02 PM Last Post: deanhystad |
|
random variable function? | Novice_fanatic | 4 | 3,533 |
Oct-08-2019, 01:22 PM Last Post: jefsummers |