Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9306127
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 19, 20262026-06-19T00:06:09+00:00 2026-06-19T00:06:09+00:00

I am trying to write a program that allows you to enter the number

  • 0

I am trying to write a program that allows you to enter the number of students in a class, and then enter 3 test grades for each student to calculate averages. I am new to programing and I keep getting an error that I don’t understand what it means or how to fix it. This is what I have so far:

students=int(input('Please enter the number of students in the class: '))

for number in students:
        first_grade=(input("Enter student's first grade: "))
        second_grade=(input("Enter student's second grade: "))
        third_grade=(input("Enter student's third grade: "))
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-19T00:06:10+00:00Added an answer on June 19, 2026 at 12:06 am

    When you wrote

    for number in students:
    

    your intention was, “run this block of code students times, where students is the value I just entered.” But in Python, the thing you pass to a for statement needs to be some kind of iterable object. In this case, what you want is just a range statement. This will generate a list of numbers, and iterating through these will allow your for loop to execute the right number of times:

    for number in range(students):
        # do stuff
    

    Under the hood, the range just generates a list of sequential numbers:

    >>> range(5)
    [0, 1, 2, 3, 4]
    

    In your case, it doesn’t really matter what the numbers are; the following two for statements would do the same thing:

    for number in range(5):
    
    for number in [1, 3, 97, 4, -32768]:
    

    But using the range version is considered more idiomatic and is more convenient if you need to alter some kind of list in your loop (which is probably what you’re going to need to do later).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to write a program that allows a binary to be run,
I am trying to write a program that will prompt you to enter someone's
i am trying to write a program that close explorer then runs another program.
I am trying to write a program that allows me to print a ssrs
I am trying to write one portion of my huge C# program that allows
I am trying to write a very simple application that allows me to enter
I am trying to write a program in C that allows me to move
Im trying to write a simple program that takes 5 images and allows you
I'm trying to write a code in C++ that allows you to enter some
I am trying to write a frame program that allows you to play Texas

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.