Looping and saving multiple inputs
<p>I'm trying to loop through a set of inputs where I ask for a user's course grade, course hours and course code. The loop keeps on repeating until the user enters "done". Once the user has entered done I want it to print out the entered courses with grade and hours. </p>

<p>For Example: </p>

<pre><code>course_count = False

#LOOP through Inputs
while not course_count:

    #GET course code
    course_code = input( "Please Enter the Course Code (or done if finished): " )

    #IF course code is not equal to done (convert to lowercase)
    if course_code.lower() != "done":

        #GET course hours
        course_hours = int( input( "How many credit hours was " + course_code + "? " ) )

        #GET grade earned
        course_grade = float( input( "What grade did you earn in " + course_code + "? " ) )

    #ELSE END LOOP
    else:
        course_count = True

    print("Course: " + course_code + " Weight: " + str( course_hours ) + " hours " + "Grade: " + str( course_grade ) + "%")
</code></pre>

<p>The problem is it will always print out only one inputted course, hour and grade. How would I save more than one answer using only accumulative strings? </p>

<p>The output I'm looking to make is:</p>

<pre><code># Please Enter the Course Code (or done if finished): COMP 10001
# How many credit hours was COMP 10001? 5
# What grade did you earn in COMP 10001? 75

# Please Enter the Course Code (or done if finished): COMP 20002
# How many credit hours was COMP 10001? 8
# What grade did you earn in COMP 10001? 95

# Please Enter the Course Code (or done if finished): done

# Course: COMP 10001 Weight: 5 Grade: 75%
# Course: COMP 20002 Weight: 8 Grade: 95%
</code></pre>

<p>It's for a school practice problem and were not allowed to use lists, arrays or dictionaries if that makes sense</p>

<p>Use an output string <code>output_string</code></p>

<p>Add each new line to the output string</p>

<pre><code>...
output_string += "Course: {} Weight: {} hours Grade: {}\n".format(course_code, course_hours, course_grade"
#ELSE END LOOP
...
</code></pre>

<p>This accumulates the information into a string, using standard string formatting to insert the data from each pass through the loop.</p>

<p>At the end of the program, print the output string.</p>

<p>As others have noted, this is a pretty silly way of storing data, since accessing it, except to print out, will be difficult. Lists/dictionaries would be a lot better. </p>

python