Oct-24-2023, 04:59 AM
So, I just learned about the keyword def; it has been going really smoothly for me because I reuse chunks of code often. However, I have run into a hiccup.
The output I would like (and expected) was a random chance between 0 and 1; however, the output given is "None." What do I have yet to learn about def?
1 2 3 4 5 6 7 8 |
import random def word(): random.randint( 0 , 1 ) y = word() print (y) |