Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I want to use at least 3 functions to re-design a program which I had coded using only the parallel lists. Here's the question: This

I want to use at least 3 functions to re-design a program which I had coded using only the parallel lists. Here's the question:image text in transcribed

This is how it looks when you print it out:

image text in transcribedI have completed the entire program using parallel lists. I want this program to be redesigned using at least 3 functions. Here is my python code:

StudentID = [ 4389, 4791, 5362, 7091, 7150]

LastName = [ "Jones", "Beckett", "Weir", "Kingsley", "Balasubramanian" ]

FirstName = [ "Aisha", "Kate", "Edgar", "Lavar", "Vijay" ]

Year = [ "freshman", "senior", "sophomore", "junior", "sophomore" ]

GPA = [ 3.1, 3.7, 3.1, 4.0, 3.5 ]

# add a student # remove a student # change student GPA # display student record # list all students # quit

print( " 1) add a student ") print( " 2) remove a student") print( " 3) change student GPA") print( " 4) display student record") print( " 5) list all numbers") print( " 0) quit")

# Create a variable for user to select options option = input("Choose an option (0,5): ")

# Use a while loop for the variable while option != "0": if option == "1":

# Create 5 variables for user to input Student_ID = int(input("Student ID:")) First_Name = input("first name:") Last_Name = input("last name:") year = input("year:") gpa = float(input("GPA:"))

# Create a variable x = 0 x = 0 # Use a while loop and set condition for x while x = StudentID[x]: x+=1 # Use Insert function for five lists StudentID.insert(x, Student_ID ) LastName.insert(x, Last_Name) FirstName.insert(x, First_Name) Year.insert(x, year) GPA.insert(x, gpa) option = input("Choose an option (0,5): ") # Create an elif statement elif option == "2": Student_ID = int(input("Student ID:"))

# Create a variable for index index = StudentID.index(Student_ID)

# Use del function to delete indext of five lists del StudentID[index] del FirstName[index] del LastName[index] del Year[index] del GPA[index] option = input("Choose an option (0,5): ") # Create an elif statement elif option == "3": Student_ID = int(input("Student ID:")) New_gpa = input(" new GPA:" ) index = StudentID.index(Student_ID) GPA[index]=New_gpa option = input("Choose an option (0,5): ")

elif option == "4": Student_ID = int(input("Student ID:")) index = StudentID.index(Student_ID)

# Print five lists as per their index values print(StudentID[index], LastName[index],FirstName[index], Year[index],GPA[index]) option = input("Choose an option (0,5): ")

elif option == "5":

# Indent a for loop in elif statement. for index in range (0,len(StudentID)): print(StudentID[index], LastName[index],FirstName[index], Year[index],GPA[index]) option = input("Choose an option (0,5): ")

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Practical Database Programming With Visual C# .NET

Authors: Ying Bai

1st Edition

0470467274, 978-0470467275

More Books

Students also viewed these Databases questions

Question

How wide are Salary Structure Ranges?

Answered: 1 week ago