Jun-02-2017, 07:00 PM
I am very new to Python (and any programming language for that matter) and have a 2 part assignment I am struggling with. Below are the instructions as written.
##### Step 1:
##### Create while loop that adds 20 random numbers between 0 and 10 to a list
##### Don't forget to create a counter and an empty list first
##### When the loop is complete, the full list should print (only at the end, not each time a number is added)
##### Step 2:
##### Create loop that removes an unlucky number from the list generated in step 3
##### IF the unlucky number is not in the list to begin with, the script should print a message that says this.
##### Otherwise, the script should print a message saying how many times the number is being removed from the list,
##### and then remove the number.
##### This will require a while loop, and the .count() method.
##### When the loop is complete, the updated list should print (only at the end, not each time a number is removed)
This may seem very basic to many, but for the complete novice like myself, I am clueless. Any tips? TIA
##### Step 1:
##### Create while loop that adds 20 random numbers between 0 and 10 to a list
##### Don't forget to create a counter and an empty list first
##### When the loop is complete, the full list should print (only at the end, not each time a number is added)
##### Step 2:
##### Create loop that removes an unlucky number from the list generated in step 3
##### IF the unlucky number is not in the list to begin with, the script should print a message that says this.
##### Otherwise, the script should print a message saying how many times the number is being removed from the list,
##### and then remove the number.
##### This will require a while loop, and the .count() method.
##### When the loop is complete, the updated list should print (only at the end, not each time a number is removed)
This may seem very basic to many, but for the complete novice like myself, I am clueless. Any tips? TIA