0

I know my question may seem very vague I'm just trying to finish an assignment and I am so very confused ;-;. I am trying to use a for loop to only take out five numbers in a list at a time in a different function. Heres the program I have so far:

def main():
    #Create empty dictionary
    gradebook = {}
    #Prompt user to enter course
    course_name = input('Enter a course name ==> ')
    #Set 'course_count' to 0
    course_count = 0
    #Create empty list
    list1 = []
    while course_name != '':
        #Prompt user to enter another course or hit enter to quit
        course_name = input('Enter another course name or press enter to end ==> ')
        #Add 1 to 'course_count' for every loop
        course_count += 1
    #Create list for every course
    for count in range(course_count):
        for count in range(5):
            #Randomly pick a number from 70 to 100
            grades = random.randint(70,100)
            #Append these values to 'list1'
            list1.append(grades)
    #I was using this to see the list that was created
    print(list1)

Any help would be appreciated. This is my discord username for anyone who would be ok with helping me any further as well:ButternutSquash#1825. Thanks!

confused
  • 19
  • 2
  • 3
    Does this help? https://stackoverflow.com/questions/434287/how-to-iterate-over-a-list-in-chunks – GooJ May 08 '23 at 14:13

0 Answers0