PYTHON PROGRAMMING
Instructions: You are responsible for writing a program that allows a user to do one of five things at a time:
1. Add students to database.
• There should be no duplicate students. If student already exists, do not add the data again; print a message informing student already exists in database.
• Enter name, age, and address.
2. Search for students in the database by name.
• User enters student name to search
• Show student name, followed by age, address, and all grades tabbed over (next line).
3. Enter grade.
• User enters an assignment (assume that the assignment already exists)
• User enters a student name (assume that student already exists in database)
• User enters a grade (It’s up to you to have grades as string or integer or float)
• The student’s grade is assigned to that assignment.
4. Add assignment.
• User enters the name of the assignment to be added
• Once an assignment is added, it exists for all students.
• The default grade is a ‘-’ character.
5. Delete assignment.
• User enters an assignment to be deleted.
• The assignment is deleted for all students.
6. Quit.
• Quits the program.
Restrictions:
1. You must use a list or dictionary or both of those.
2. You must use an infinite loop.
3. You must use a break statement.
""" Adding student to the dictionary """
def add_student(details, student):
if student not in details:
details[student] = {}
else:
print("Student already exists in database")
return details
""" Adding students detail to the dictionary"""
def add_details(name, age, address, details, student):
details[student]['name'] = name
details[student]['age'] = age
details[student]['address'] = address
""" Searching student from the dictionary"""
def search_student(details, name):
for (k, v) in details.items():
if details[k]['name'] == name:
print(details[k])
break
""" Adding grade to the student """
def add_grade(details, student, assignment, grade):
details[student][assignment][grade] = grade
"""Adding new assignment to the student"""
def add_assignment(details, assignment):
for k, v in details.items():
details[k][assignment] = {'grade': '-'}
print(details)
"""Deleting the requested assignment """
def delete_assignment(details,name, assignment):
if details[name][assignment]:
del details[name][assignment]
def main():
details = {} # dictionary for storing the student details
while True:
student = input("Enter student")
add_student(details, student)
name = input("Enter student name")
age = int(input("Enter age"))
address = input("Enter address")
add_details(name, age, address, details, student)
search_name = input("Enter name you want to search for")
search_student(details, search_name)
assignment = input("Enter assignment")
add_assignment(details, assignment)
grade = input("Enter grade")
add_grade(details, student, assignment, grade)
remove_assignment = input("Enter assignment")
delete_assignment(details, name,remove_assignment)
n = int(input("If you want to quit please enter 1 else input some other number"))
if n == 1:
break
if __name__ == '__main__':
main()
PYTHON PROGRAMMING Instructions: You are responsible for writing a program that allows a user to do...
Write a program that asks the user for a student name and asks for grades until the user enters a non-number input, it should then ask if the user wants to enter another student, and keep doing the process until the user stops adding students. The student’s must be stored in a dictionary with their names as the keys and grades in a list. The program should then iterate over the dictionary elements producing the min, max, and mean of...
Design and code a JAVA program called ‘Grades’. ? Your system should store student’s name, and his/her course names with grades. ? Your system should allow the user to input, update, delete, list and search students’ grades. ? Each student has a name (assuming no students share the same name) and some course/grade pairs. If an existing name detected, user can choose to quit or to add new courses to that student. ? Each student has 1 to 5 courses,...
Write a program that performs the following: 1. Presents the user a menu where they choose between: a. Add a new student to the class i. Prompts for first name, last name ii. If assignments already exist, ask user for new student’s scores to assignments b. Assign grades for a new assignment i. If students already exist, prompt user with student name, ask them for score ii. Students created after assignment will need to...
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...
In this assignment, you will write a program in C++ which uses files and nested loops to create a file from the quiz grades entered by the user, then reads the grades from the file and calculates each student’s average grade and the average quiz grade for the class. Each student takes 6 quizzes (unknown number of students). Use a nested loop to write each student’s quiz grades to a file. Then read the data from the file in order...
This code should be written in php. Write a program that allows the user to input a student's last name, along with that student's grades in English, History, Math, Science, and Geography. When the user submits this information, store it in an associative array, like this: Smith=61 67 75 80 72 where the key is the student's last name, and the grades are combined into a single space-delimited string. Return the user back to the data entry screen, to allow...
[JAVA/chapter 7] Assignment: Write a program to process scores for a set of students. Arrays and methods must be used for this program. Process: •Read the number of students in a class. Make sure that the user enters 1 or more students. •Create an array with the number of students entered by the user. •Then, read the name and the test score for each student. •Calculate the best or highest score. •Then, Calculate letter grades based on the following criteria:...
Java program
Program: Grade Stats In this program you will create a utility to calculate and display various statistics about the grades of a class. In particular, you will read a CSV file (comma separated value) that stores the grades for a class, and then print out various statistics, either for the whole class, individual assignments, or individual students Things you will learn Robustly parsing simple text files Defining your own objects and using them in a program Handling multiple...
Write a C program that allows a user to enter up to 30 student id’s and 3 grades per student. It will then compute and display a report of the students averages, and then a statement of the class average for those grades. The following is a sample run that demonstrates what your program should look like: Please enter your school name: Cape Tech Welcome to the Cape Tech Grade Calculator Enter the number of students to process (0 -...
In Python In this programming assignment, you will do multiple programming exercises, and eventually develop a Python application that can calculate student course grades. (6 points) Write a program called p2-1.py to: (1) create a list and add integer numbers from 1 to 100 to the list; (2) calculate the average value of all numbers in the list; and (3) print the result (screenshots). (8 points) Write a program called p2-2.py to: (1) allow a user to define how many...