Python: Printing Student Data
Assumptions
You may assume the following
Input(Exactly)
5 Stan Marsh 3.6 Kenny McCormick 2.3 Someone with a really long name more than 20 characters Eric Cartman -1.1 Kyle Broflovski 4.0 Output(Exactly)
How many students are in the class? Enter the name of student: Enter the gpa of student: Enter the name of student: Enter the gpa of student: Enter the name of student: Name of student cannot exceed 24 characters. Enter the name of student: Enter the gpa of student: GPA of student must be between 0.0 and 4.0. Enter the name of student: Enter the gpa of student: Number Name GPA ------------------------------------- 1 Stan Marsh 3.6 2 Kenny McCormick 2.3 5 Kyle Broflovski 4.0 Average GPA: 3.3000000000000003
Requirements
To solve this problem, you must use the following python features:
You may not use a string formatter
Python Code:
stuNum = int(input('How many students are in the class? '))
#getting number of students
stuList = [] #to store list of students who are valid
for i in range(0, stuNum): #looping to get student data
stuData = [] #to store current student data
stuName = input('Enter the name of student: ')
if len(stuName)> 24: #validating student name
print('Name of student cannot exceed 24 characters.')
continue
stuGpa = float(input('Enter the gpa of student: '))
if stuGpa < 0 or stuGpa > 4: #validating student GPA
print('GPA of student must be between 0.0 and 4.0.')
continue
stuData.append(stuName) #appending name to current student
stuData.append(stuGpa) #appending GPA to current student
stuList.append(stuData) #adding to main list
if len(stuList) > 0: #displaying output if there are valid
students
print('Number' + ' ' * 3 + 'Name' + ' ' * 20 + 'GPA') #header
print('-' * 37) #37 hypens
sumGpa = 0 #to store GPA sum
for item in stuList: #displaying result of ech student
stuNumber = stuList.index(item) + 1
stuName = item[0]
stuGpa = item[1]
sumGpa += stuGpa #calculating sum
print(str(stuNumber) + ' ' * (10 - len(str(stuNumber)) - 1) +
stuName + ' ' * (24 - len(stuName)) + str(stuGpa))
print('Average GPA: ' + str(sumGpa/(len(stuList)))) #displaying avg
GPA

Sample Output:

Python: Printing Student Data Ask the user: "How many students are in the class?" Read in...
Python : Need help with output of table Code: # Number of students print('How many students are in the class?') student_Number = int(input()) # Store list of students who are valid student_List = [] for i in range(0, student_Number): # To store current student data student_Data = [] print('Enter the name of student:') # Name of Students student_Name = input() if len(student_Name)> 24: print('Name of student cannot exceed 24 characters.') continue print('Enter the gpa of student:') # GPA of Student...
I need code in java
The Student class:
CODE IN JAVA:
Student.java file:
public class Student {
private String name;
private double gpa;
private int idNumber;
public Student() {
this.name = "";
this.gpa = 0;
this.idNumber = 0;
}
public Student(String name, double gpa, int
idNumber) {
this.name = name;
this.gpa = gpa;
this.idNumber = idNumber;
}
public Student(Student s)...
Please help, provide source code in c++(photos attached)
develop a class called Student with the following protected
data:
name (string), id (string), units (int), gpa (double).
Public functions include:
default constructor, copy constructor, overloaded = operator,
destructor, read() to read data into it, print() to print its data,
get_name() which returns name and get_gpa() which returns the
gpa.
Derive a class called StuWorker (for student worker) from
Student with the following added data:
hours (int for hours assigned per week),...
PYTHON*************** Create a Person Class that: Accepts First Name, Last Name, Age, and Gender Has a method that adds all persons Validate all input, not left empty for First Name, Last Name, Gender and numeric for age and throw an exception if it does not validate within the class. Create a Student Class that: Inherits the Person Class Accepts GPA Validate GPA (>= 0 and <= 4.0) and throw exception if it does not validate within the class. Has methods...
You are asked to define a user-defined data type for students, that will contain the following information about a student: ID number, first name, last name, major, GPA. Your structure should be cal Student. Based on the defined structure, user name on the command line, show how you will use a loop to search for the given name within the array of 5 students. use an array to record information about 5 students. Then, given a Write a C program...
In python, Implement a function studentID() which allows the user to enter the 7-digit student ID. The program will keep prompting the user for a last name and first name. If the student does not have a student ID on record, the program will then ask for the student ID, and store that information. If the student already has a student ID, the program will display it, and ask for confirmation whether a new studentID should be assigned (and, if...
For C++ program Your program should first prompt the user for the number of students they wish to enter. For each student, the user will be prompted to enter the student’s name, how many tests the student has taken, and the grade for each test. Each test’s grade will be inputted as a number representing the grade for that test. Once each student’s information has been entered, the program will display the number of students. Additionally, each student will have...
you must implement public class Student by following the instructions as follows exactly. You may reference Chapter 7 for the similar examples to get the ideas and concepts. Each student must have the following 5 attributes (i.e., instance variables): private String studentID ; // student’s ID such as 1 private String lastName ; // student’s last name such as Doe private String firstName ; // student’s first name such as John private double gpa...
Write a C++ program that asks user number of students in a class and their names. Number of students are limited to 100 maximum. Then, it will ask for 3 test scores of each student. The program will calculate the average of test scores for each student and display with their names. Then, it will sort the averages in descending order and display the sorted list with students’ names and ranking. Follow the Steps Below Save the project as A4_StudentRanking_yourname....
Must be written in JAVA Code Write a program that will read in a file of student academic credit data and create a list of students on academic warning. The list of students on warning will be written to a file. Each line of the input file will contain the student name (a single String with no spaces), the number of semester hours earned (an integer), the total quality points earned (a double). The following shows part of a typical...