Hey everybody. All my Google searches for help led me here so I thought I'd post my actual problem directly. I'm in a 101 programming course and this is only our second Python assignment. What I need to do is use one-dimensional parallel arrays to allow input of four different grades for a single student. I know that I need to use multiple arrays, ex: grade1[], grade2[], etc., but I'm not sure of what subscript to use or how to implement the arrays into the code. Our text doesn't go over the use of more than two one-dimensional arrays and we're not allowed to use two-dimensional arrays.

Edit: The code I came up with is below but instead of just inputting a single grade into each array, it makes me input four different grades, four different times.

stdtn = (input("Enter the student's name. Enter Q to quit."))
while stdtn != "Q":
    stdts[count] = stdtn
    assgn = 1
    while assgn < 5:
        grade1[count] = int(input("Enter the grade for assignment 1."))
        grade2[count] = int(input("Enter the grade for assignment 2."))
        grade3[count] = int(input("Enter the grade for assignment 3."))
        grade4[count] = int(input("Enter the grade for assignment 4."))
        assgn = assgn + 1
    count = count + 1
    stdtn = input("Enter the next student's name. Enter Q to quit.")
T = 0

Any help or pointing-in-the-right-direction would be very appreciated.

The first thing I'd do to change your code is to make the loop while True: and then add if student_name.lower() == 'q': break That allows you to move the input for student name inside the loop (and that means you only write it once). Your inner loop can be a for loop, to avoid hand-incrementing the assignment number: for assignment_number in range(4): You can also use count += 1 to increment the count.

Aside: As you may see, I am a proponent of spelling out variable names in full. This comes from experience doing maintenance on code. Abbreviations are arbitrary. Why 'stdtn' and not 'stnum', for instance? The small amount of extra typing will save you months of looking things up over the course of a career. (IDEs do help with that, but why bother? Self documenting code is better code).

The other problem is the conditions: Only 1-D arrays. To manage that, you need to have a fixed number of either students or grades. You name the array of (fixed number items) any arbitrary way, such as student_[I]N[/I] or grade_[I]N[/I] . You then iterate, as your code shows, over the unfixed variable until done.

I have a fixed number of both students and grades, 30, but it still asks for four assignment grades four times, when I only need to input four different assignment grades for one student. Did you already advise me on that or did I misread? Thanks for the loop adjustments though.

If you look at your own code objectively (which is hard when you're in a blind panic about finishing an assignment on schedule), you'll see that you're running your grade-input-loop four times, and in each time through the loop, you're asking for each of four grades. Do one or the other, and your problem will be solved! (Hint: since you're keeping separate arrays for the grades, I'd recommend getting rid of the inner loop. ;) )

Duh, it seems obvious now. I do feel bad for posting assignment help, which I'm sure Daniweb users look down upon, but thanks to the both of you for helping. :icon_cheesygrin: