"random" doesn't work. Can you help me?

Replit sorusu

I want to have random numbers on line 64. However I always see the same number even though I indicate random on line 53 and 58. What is the problem and how can I have different random numbers in each one?

Welcome to the community!

Can you give a link to your repl? This way it will be easier for us to solve your problem.

2 Likes

It’s because you set your variable before the loop. So random does work. You just need to declare the variable in the loop.

5 Likes

https://replit.com/@ozgupp/LevelSelection#main.py

Welcome to the community @ozgupp!
The error seems to be an indentation error at the moment.

3 Likes

I did what you said and my code runned as I want. Thank you so much!

3 Likes

I’m glad I could help!
I hope you succeed in making your program!

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.