Question

In: Computer Science

#promt the user to enter student name for i in range(0, 3): print ("Enter student's first...

#promt the user to enter student name for i in range(0, 3): print ("Enter student's first and last name") #variable for name name = input() #prompt the user to enter number of book purchased print ("Enter the number of book the student purchased this month") #varibale for number of book book_number = input() book_number = int (book_number) #point = int (point) if (book_number <=0): points = 0 elif (book_number <=3): points = 5 elif (book_number <=6): points = 10 elif (book_number <=8): points = 15 elif (book_number ==9): points = 20 else : points = 25 print (name , "earned" ,points)

this is my python code but it is not printing all the names and points, just printing the last one.

Solutions

Expert Solution

To get the correct output take last print statement must be in for loop.

Correct program:

#promt the user to enter student name

for i in range(0, 3):

print ("Enter student's first and last name") #variable for name

name = input()

#prompt the user to enter number of book purchased

print ("Enter the number of book the student purchased this month")

#varibale for number of book

book_number = input()

book_number = int (book_number)

#point = int (point)

if (book_number <=0):

points = 0

elif (book_number <=3):

points = 5

elif (book_number <=6):

points = 10

elif (book_number <=8):

points = 15

elif (book_number ==9):

points = 20

else :

points = 25

print (name , "earned" ,points)

Output:


Related Solutions

Write a Python program that asks the user to enter a student's name and 8 numeric...
Write a Python program that asks the user to enter a student's name and 8 numeric tests scores (out of 100 for each test). The name will be a local variable. The program should display a letter grade for each score, and the average test score, along with the student's name. Write the following functions in the program: calc_average - this function should accept 8 test scores as arguments and return the average of the scores per student determine_grade -...
PYTHON Write a program that asks the user to enter a student's name and 8 numeric...
PYTHON Write a program that asks the user to enter a student's name and 8 numeric assignment scores (out of 100 for each assignment). The program should output the student's name, a letter grade for each assignment score, and a cumulative average for all the assignments. Please note, there are 12 students in the class so your program will need to be able to either accept data for 12 students or loop 12 times in order to process all the...
Write a python program that asks the user to enter a student's name and 6 numeric...
Write a python program that asks the user to enter a student's name and 6 numeric tests scores (out of 100 for each test). The name will be a global variable. Create functions to calculate a letter grade for the student and calculate the average of the test scores for the student. The program should display a letter grade for each score, and the average test score, along with the student's name. Assume 6 students in the class. Functions in...
Write a PYTHON program that asks the user to enter a student's name and 8 numeric...
Write a PYTHON program that asks the user to enter a student's name and 8 numeric tests scores (out of 100 for each test). The name will be a local variable. The program should display a letter grade for each score, and the average test score, along with the student's name. Write the following functions in the program: calc_average - this function should accept 8 test scores as arguments and return the average of the scores per student. determine_grade -...
Python question Write a program that asks the user to enter a student's name and 8...
Python question Write a program that asks the user to enter a student's name and 8 numeric tests scores (out of 100 for each test). The name will be a local variable. The program should display a letter grade for each score, and the average test score, along with the student's name. Write the following functions in the program: calc_average - this function should accept 8 test scores as arguments and return the average of the scores per student determine_grade...
This question concerns writing a Student class to model a student's name, composed of a first...
This question concerns writing a Student class to model a student's name, composed of a first name, middle name and last name. The Student class should meet the following specification: Class Student A Student object represents a student. A student has a first name, middle name and last name. Methods public void setNames(String first, String middle, String last) // Set the first, middle and last names of this Student object. public String getFullName() // Obtain the full name of this...
using python 3 1. Two-line input: print a prompt (e.g Enter your first name) and then...
using python 3 1. Two-line input: print a prompt (e.g Enter your first name) and then assign the input to a variable print ("Enter your first name")# the word prompt is the message the user should see firstName = input() print (firstName)
Python Code: Write a program to prompt the user to enter a first name, last name,...
Python Code: Write a program to prompt the user to enter a first name, last name, student ID, number of hours completed and GPA for 5 students. Use a loop to accept the data listed below. Save the records in a text file. Write a second program that reads the records from your new text file, then determines if the student qualifies for Dean’s list or probation. Display the records read from the file on screen with appropriate headings above...
First, the Python program prompts user to enter user information (name, email, and phone number). Then...
First, the Python program prompts user to enter user information (name, email, and phone number). Then it displays a menu called “Fish Information” that has the following fish type: 1. Cat Fish 2. Red Fish 3. Any other fish Let user choose the fish type that he/she got and input the length of the fish. Then the program will determine what should be done with this particular fish. Based on the following criteria: Criteria: Length: FISHTYPE - Cat Fish <10:...
JAVA StudentId: Consist of the first two characters of the student's first name, student's birth year,...
JAVA StudentId: Consist of the first two characters of the student's first name, student's birth year, and the last two characters of the last name. For instance, if the student full name is John Doe and birthyear is 1995, then the id will be Jo1995oe. Birthday is using GregorianCalendar. String firstname String lastname GregorianCalendar birthday
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT