import random
a = random.randrange(1,101)
def print_rand(n):
for i in range(3):
a = random.randrange(1,101)
print_rand(3)
print(f'{a}')
The question is how to get it back and how to use it. Let's just make it up without knowing your Python learning progress:
import random
# If you receive the number n, you take the number from 1 to 101 n times and return the list
def get_randoms(n):
return list(map(lambda x: random.randrange(1, 101), range(n)))
# Can cause even 17 instead of 3
r3 = get_randoms(3)
print(r3)
r17 = get_randoms(17)
print(r17)
PS. To answer the question "what's wrong" itself, the print_land
function you created is:
The part is not correct.
© 2024 OneMinuteCode. All rights reserved.