I am very new to programming and to a site like this and am in fact just starting class. I understand the basics of Python and have been banging my head against the wall with this for two days now.
Below are the requirements for the program followed by my embarrassing attempt at the code immediately after. I'm not looking for it to be given to me, but I just can't figure out how to move forward.
- In main, generate a random
integerthat is greater than 5 and less than 13. - Print this number on its own line.
- Call the makelist function with the random integer as the sole argument.
Inside the
makelistfunction:Make an empty list.
Use a loop to append to the list a number of elements equal to the random integer argument. All new list elements must be random integers ranging from 1 to 100, inclusive. Duplicates are okay.
Return the list to main.
Back in main, catch the returned list and sort it.
- Finally, use a
forloop to display the sorted list elements, all on one line, - Separated by single spaces.
Code so far:
import random
def main():
random_int = random.randint(6, 12)
print (random_int)
makelist()
def makelist():
num_list = []
for count in range(1, 101)
num_list.append(random_int)
main()