random integer
AnnaBuell (0)

How do I get my program to select a random integer between 1 and 100?

You are viewing a single comment. View All
AllAwesome497 (367)

This is how you get a random number:

import random  # At the beginning of the file
random_number = random.randint(<lowest number>, <highest number>)  # Choose a number between arg 1 and arg 2, includes the top and bottom numbers
PDanielY (983)

@AllAwesome497 is correct. And maybe when you ask for someone to guess a number turn the number into with int(input()) before you compare it.