Jan-12-2019, 08:16 PM
Please use python and output tags when posting code and results. I put them in for you this time. Here are instructions for doing it yourself next time.
First, don't name a variable list. The word list has meaning in python, and if you use it as a variable name, you lose access to that, and so does other code that may depend on it.
On line 4, you assign a random number to list. Fifty times you do this, and every time you are writing over the last one you did. So at the end, list is just a random number, and the variable 'a' only has one number in it. You want to initialize the list, and then append to it in the loop:
First, don't name a variable list. The word list has meaning in python, and if you use it as a variable name, you lose access to that, and so does other code that may depend on it.
On line 4, you assign a random number to list. Fifty times you do this, and every time you are writing over the last one you did. So at the end, list is just a random number, and the variable 'a' only has one number in it. You want to initialize the list, and then append to it in the loop:
numbers = [] for number in range(50): numbers.append(random.randint(1, 100)
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures