0

How to make code to pick random number

I want to make a code which will when you enter for example 2 name and it shows a random number.

10th Nov 2020, 8:09 PM
Boske - Football
Boske - Football - avatar
3 Antworten
+ 6
Boske - Football , it is clear what you want, but not in all details. You mention that you will enter 2 names. OK - no problem. Then a random number should be created. I am rather sure, that this number has to be in a range from n to n1. Please give us more information. Thanks!
10th Nov 2020, 9:01 PM
Lothar
Lothar - avatar
+ 5
You can import the 'random' module and the use one of its methods, e.g. randint(). Have a look at https://www.w3schools.com/JUMP_LINK__&&__python__&&__JUMP_LINK/module_random.asp
10th Nov 2020, 8:27 PM
David Ashton
David Ashton - avatar
+ 1
From random import randint x = int(input()) y = int(input()) z = randint(x, y) print(z) Input 2 numbers and it will pick a number in between those 2
10th Nov 2020, 8:36 PM
Stan Lipman
Stan Lipman - avatar