Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help with randint/random
#1
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.
Reply


Messages In This Thread
Help with randint/random - by Tunechi - May-14-2018, 02:08 AM
RE: Help with randint/random - by micseydel - May-14-2018, 02:23 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  random numbers, randint janeik 2 586 Nov-27-2023, 05:17 PM
Last Post: janeik
  Unexpected output while using random.randint with def terickson2367 1 542 Oct-24-2023, 05:56 AM
Last Post: buran
Sad Iterate randint() multiple times when calling a function Jake123 2 2,103 Feb-15-2022, 10:56 PM
Last Post: deanhystad
  Using Dictionary to Test Evenness of Distribution Generated by Randint Function new_coder_231013 6 3,341 Feb-23-2021, 01:29 PM
Last Post: new_coder_231013
  Help with a random.randint choice in Python booponion 5 2,849 Oct-23-2020, 05:13 PM
Last Post: deanhystad
  Inheriting, given number from randint is not working beLIEve 0 1,530 Oct-12-2019, 06:50 PM
Last Post: beLIEve
  same number everytime when using random.randint summeringpainting 5 8,251 Aug-23-2019, 11:01 AM
Last Post: Malt
  randint stops changing values in a loop Naito 4 3,389 Jan-30-2019, 08:15 AM
Last Post: perfringo

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020