A python question from a newbee?

So I'm taking a required Python class(I'm not going to be a programmer),but I am enjoying it. The class is online and has pretty sub-par instruction. I'm tasked with this: Your program should include a list of five names. Using a for loop, it should successively prompt the user for the quiz grade for each of the five students. Each prompt should include the name of the student whose quiz grade is to be input. It should compute and display the average of those five grades and the highest grade. You should decide on the names of the five students.

I don't even know where to begin. I would know how to do this without using a for loop but I'm lost with the requirement to use one. The only examples of for loops we have gone over is how to find the largest number and the smallest number, how to add the contents of a list together, and how to count the items in a list. none of which, is applicable to prompting each user for an input. Any help would be much appreciated.

Update:

My best attempt would be:

Students = [Joe, Bob, Ally, Jack, Jill]

for student in students:

    input(print(student, "What was your test score percentage?")

but if i assign that input to a variable so I can use it later, like:

test_1 = input(print(student, "What was your test score percentage?")

Then it will just assign every input to that 1 variable and only use the last one assigned to it right?

Update 2:

Thanks @EddieJ that helped

Update 3:

One last thing, for this part "int (input ("What was test score for " + student + "? "))" The output is like this "What was test score forJoe?") with no space between for and Joe. How do I put a space? if i use a comma i get a syntax error

1 Answer

Relevance
  • EddieJ
    Lv 7
    1 month ago
    Favorite Answer

    Edit2: If you typed it like it's above you SHOULD see a space in the prompt.

    I hope you will give me Best Answer.  I'm only mentioning this because, lately, no one has been doing so (for anyone).

    Edit:  I'm looking at your program.

    The input () function includes a prompt argument -- you don't have you put print () inside it.  But you need to use plus sign to concatenate the parts, input () only allows ONE argument.

    test = int (input ("What was test score for " + student + "? "))

    You need to put quotes around the names in the list.

    You need to spell students consistently -- case matters.

    So, you need to initialize a variable for the total and then add the score to it within the loop.

Still have questions? Get your answers by asking now.