+ 1

i take it we are finding random integers within 1 and 6 here? also is random a real module or just used as an example for us to

import random for i in range(5): value = random.randint(1, 6) print(value) Result: >>> 2 3 6 5 4 >>>

25th Jan 2020, 4:11 PM
Corola
Corola - avatar
3 Antworten
+ 1
random is a real module in Python, used to generate pseudo random numbers. In this example, a random number between 1 and 6 is generated and printed to the console five times. In fact, random.randint is used to find a random number.
25th Jan 2020, 4:13 PM
Jianmin Chen
Jianmin Chen - avatar
0
example
25th Jan 2020, 4:12 PM
BroFar
BroFar - avatar
0
random is a real module in Python with atleast very 3 useful methods: choice: takes 1 iterable as an argument and randomly selects an item from it. randint: takes 2 integers as arguments and randomly selects any integer between the 2 integers. random: takes no arguments and randomly selects any float between 0 and 1.
25th Jan 2020, 5:12 PM
Seb TheS
Seb TheS - avatar