Question

In: Computer Science

Python Coding: Working with Conditions and Dictionaries. 1. Create three dictionaries (student_1, student_2, student_3). 2. In...

Python Coding:

Working with Conditions and Dictionaries.

1. Create three dictionaries (student_1, student_2, student_3).

2. In each student dictionary have a key-value for first_name, last_name, and an id number (6 digit), and a current_course. The values assigned to each of these keys is your choice.

3. Also each student will have in their dictionary a list for grades. You will need to add 3 grade values into the list.

4. Provide the student with a message about each assignment grade based on the grade value.

For each of the grades for each assignment:

Provide a 90-100 grade message. My example used 'Congratulations'

Provide a 80-89 grade message. My example used 'Good job!'

Provide a 70-79 grade message. My example used 'You passed!'

Provide a 60-69 grade message. My example used 'Bad news, below average'

59 or lower grade message would be 'Failed.'

For each grade:

'You have made a {grade value} on assignment {assignment number}.

5. Print out each student's data as shown in the example output below:

Name: Smith, John   

Id: 646562   

Course: ITSE 1359

Grades: 86, 74, 94

Good job!

You have made a 86 on assignment 1.

You passed!

You have made a 74 on assignment 2.

Congratulations

You have made a 94 on assignment 3.

Solutions

Expert Solution

student1={"firstname":"ramana","lastname":"meesala","id":"101","course":"python","grades":[79,56,12]}
student2={"firstname":"pooja","lastname":"kalsi","id":"102","course":"python","grades":[87,12,99]}
student3={"firstname":"meghana","lastname":"pasam","id":"103","course":"python","grades":[45,65,32]}
print("Name: ",student1["firstname"],",", student1["lastname"])   
print("Id: ",student1["id"])   
print("Course: ",student1["course"])
l=student1.get("grades")
print("Grades: ",l[0],",",l[1],",",l[2])
for i in range(3):
    if(90<=l[i]<=100):
        print("Congratulations")
        print("You have made a ",l[i]," on assignment ",i+1)
    elif(80<=l[i]<=89):
        print("Good job!")
        print("You have made a ",l[i]," on assignment ",i+1)
    elif(70<=l[i]<=79):
        print("You passed!")
        print("You have made a ",l[i]," on assignment ",i+1)
    elif(60<=l[i]<=69):
        print("Bad news, below average")
        print("You have made a ",l[i]," on assignment ",i+1)
    elif(l[i]<=59):
        print("Failed")
        print("You have made a ",l[i]," on assignment ",i+1)
        
print("Name: ",student2["firstname"],",", student2["lastname"])   
print("Id: ",student2["id"])   
print("Course: ",student2["course"])
l=student2.get("grades")
print("Grades: ",l[0],",",l[1],",",l[2])
for i in range(3):
    if(90<=l[i]<=100):
        print("Congratulations")
        print("You have made a ",l[i]," on assignment ",i+1)
    elif(80<=l[i]<=89):
        print("Good job!")
        print("You have made a ",l[i]," on assignment ",i+1)
    elif(70<=l[i]<=79):
        print("You passed!")
        print("You have made a ",l[i]," on assignment ",i+1)
    elif(60<=l[i]<=69):
        print("Bad news, below average")
        print("You have made a ",l[i]," on assignment ",i+1)
    elif(l[i]<=59):
        print("Failed")
        print("You have made a ",l[i]," on assignment ",i+1)
           
print("Name: ",student3["firstname"],",", student3["lastname"])   
print("Id: ",student3["id"])   
print("Course: ",student3["course"])
l=student3.get("grades")
print("Grades: ",l[0],",",l[1],",",l[2])
for i in range(3):
    if(90<=l[i]<=100):
        print("Congratulations")
        print("You have made a ",l[i]," on assignment ",i+1)
    elif(80<=l[i]<=89):
        print("Good job!")
        print("You have made a ",l[i]," on assignment ",i+1)
    elif(70<=l[i]<=79):
        print("You passed!")
        print("You have made a ",l[i]," on assignment ",i+1)
    elif(60<=l[i]<=69):
        print("Bad news, below average")
        print("You have made a ",l[i]," on assignment ",i+1)
    elif(l[i]<=59):
        print("Failed")
        print("You have made a ",l[i]," on assignment ",i+1)
           

Related Solutions

Python Coding Create function openAndReturnLastN() to meet the conditions below - accept 2 parameters; 1 string...
Python Coding Create function openAndReturnLastN() to meet the conditions below - accept 2 parameters; 1 string (name of a file) and 1 integer (N) - add a docstring - use exception handling techniques to attempt to open the filename provided, if it does not exist, return False - the file will contain an unknown number of lines - store the last N lines of the file in a single string var - return the resultant string var --- ensure to...
Using a Python environment of your choice – Create the following three dictionaries: Gary, Alice, and...
Using a Python environment of your choice – Create the following three dictionaries: Gary, Alice, and Tyler Gary = { "name": "Gary", "homework": [90.0,97.0,75.0,92.0], "quizzes": [88.0,40.0,94.0], "tests": [75.0,90.0] } Alice = { "name": "Alice", "homework": [100.0, 92.0, 98.0, 100.0], "quizzes": [82.0, 83.0, 91.0], "tests": [89.0, 97.0] } Tyler = { "name": "Tyler", "homework": [0.0, 87.0, 75.0, 22.0], "quizzes": [0.0, 75.0, 78.0], "tests": [100.0, 100.0] } Insert one additional (new) dictionary of your choice Create a new list named students that...
Using a Python environment of your choice – Create the following three dictionaries: Gary, Alice, and...
Using a Python environment of your choice – Create the following three dictionaries: Gary, Alice, and Tyler Gary = { "name": "Gary", "homework": [90.0,97.0,75.0,92.0], "quizzes": [88.0,40.0,94.0], "tests": [75.0,90.0] } Alice = { "name": "Alice", "homework": [100.0, 92.0, 98.0, 100.0], "quizzes": [82.0, 83.0, 91.0], "tests": [89.0, 97.0] } Tyler = { "name": "Tyler", "homework": [0.0, 87.0, 75.0, 22.0], "quizzes": [0.0, 75.0, 78.0], "tests": [100.0, 100.0] } Insert one additional (new) dictionary of your choice Create a new list named students that...
Python Create Loop 1 = 1 1 + 2 = 3 1 + 2 + 3...
Python Create Loop 1 = 1 1 + 2 = 3 1 + 2 + 3 = 6 1 + 2 + 3 + 4 = 10 1 + 2 + 3 + 4 + 5 = 15 Create a loop in python that makes this pattern
PYTHON CODING Create a method for a Binary Search tree that finds the lowest common ancestor...
PYTHON CODING Create a method for a Binary Search tree that finds the lowest common ancestor of two nodes in a tree (nodesLCA). The two nodes are input by the user identified by their values. Discuss method's Big-O notation. Add proper and consistent documentation to identify code sections or lines to clearly identify its purpose.Illustrate the performance of the nodesLCA method. For the BST of datalist excute the method on following pairs: (500, 271), (21, 203) and (53 , 991)...
PYTHON CODING Create a method for a Binary Search tree that finds the lowest common ancestor...
PYTHON CODING Create a method for a Binary Search tree that finds the lowest common ancestor of two nodes in a tree (nodesLCA). The two nodes are input by the user identified by their values. Discuss method's Big-O notation. Add proper and consistent documentation to identify code sections or lines to clearly identify its purpose. Illustrate the performance of the nodesLCA method. For the BST of datalist excute the method on following pairs: (500, 271), (21, 203) and (53 ,...
PYTHON CODING Create a method for the Binary Search Tree (deleteNode) that deletes a specified node...
PYTHON CODING Create a method for the Binary Search Tree (deleteNode) that deletes a specified node identified by its value, and rearranges the descendants of the deleted node to ensure the resulting Tree meets the requirements of a Binary Search Tree. a) Discuss and justify your approach to address each possible case. b) Is the new tree (with the deleted node removed) unique? Discuss your answer. Discuss method's Big-O notation. Add proper and consistent documentation to identify code sections or...
PYTHON CODING Create a method (sortTraversal) for a Binary Search Tree that prints out the Binary...
PYTHON CODING Create a method (sortTraversal) for a Binary Search Tree that prints out the Binary Search Tree in ascending or deceasing order. The order type is an input to the method and can be "ascending" or "descending". The ascending input would return the node values of the tree beginning with the smallest and ending with the largest, descending returns the opposite. Discuss method's Big-O notation. Add proper and consistent documentation to identify code sections or lines to clearly identify...
PYTHON CODING Create a method for the Binary Search Tree (deleteNode) that deletes a specified node...
PYTHON CODING Create a method for the Binary Search Tree (deleteNode) that deletes a specified node identified by its value, and rearranges the descendants of the deleted node to ensure the resulting Tree meets the requirements of a Binary Search Tree. a) Discuss and justify your approach to address each possible case. b) Is the new tree (with the deleted node removed) unique? Discuss your answer. Discuss method's Big-O notation. Add proper and consistent documentation to identify code sections or...
Working with Python. I had to create a jackalope, with half an image of an antelope...
Working with Python. I had to create a jackalope, with half an image of an antelope and half rabbit. Here is my code: def animalCollage(): antelope = makePicture(pickAFile()) rabbit = makePicture(pickAFile()) antPixel = getPixels(antelope) rabPixel = getPixels(rabbit)    for index in range(len(antPixel)/2,len(antPixel)): newColor = getColor(rabPixel[index]) setColor(antPixel[index], newColor) writePictureTo(antelope, "C:/Users/janin/OneDrive - Grand Canyon University/Grand Canyon University/CST-111/Week 6/jackalope.jpg") jackalope = pickAFile() show(antelope) My code worked fine, but my instructor said: "the python code to create the jackalope looks fine except I can't...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT