Help with randint/random - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: Help with randint/random (/thread-10120.html) |
Help with randint/random - Tunechi - May-14-2018 I'm trying to learn how to do the randint function by searching online but when I ever I try using what websites say, I get an error message and I want to understand what I'm doing wrong. This is what I copied from websites and get an error with: import random print random.randint(0,5)Am I missing something? Any help would be appreciated, thanks in advance. RE: Help with randint/random - micseydel - May-14-2018 You need to include the error message when you get one. I'm guessing it's because you're using Python 2 examples when you have Python 3 installed. You need to use parenthesis with print , like so:print(random.randint(0,5)) |