How to ues Python dictionary, enter the student information and get the following classification.
The student id is "key" and the subject name and grade is "value" to form the following form.

This is my code, I don't know how to use the dictionary..
student_list = []
a = input("Student information 1: ")
b = input("Student information 2: ")
student_list.append(a[])
student_list.append(b)
print(student_list)
print(" {}".format([a] + [b]));

Program :
#dictionary for storing student details
#dictionary is of the form "key" : "value"
#here key is student id
#here value is subject, name and grade
student_dict = {}
#read the number of students
#whose data is to be entered
num_of_students = int(input("Enter the number of students :
"))
#read the students data
#number_of_students + 1 is used, because range() start from 1
for i in range(1,num_of_students + 1):
a = input("Student information %d : "%i).split()
#here data is read in the form
# 2018000 CS peter 70
# it is split into a list as
# a = [2018000,CS,Peter,70]
#here key is a[0] , i.e., 2018000
#here value is a[1:] , i.e., [CS,Peter,70]
# a[1:] returns a list from index 1 to the end
#enter the split data to
dictionary
#student["key"] = value
student_dict[a[0]] = a[1:]
#display the values in student dictionary
#in the form key [ value ]
for stu in student_dict:
print(stu,student_dict[stu])
Output :

Source code screenshot :

How to ues Python dictionary, enter the student information and get the following classification. The student...
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...
In python, PART A: I am trying to get a dictionary with size(4, 5, 6) as keys and an array for key containing a list of values (words from file of respective size) associated with those keys I am reading from a file of strings, where I am only interested with words of length 4, 5, and 6 to compute my program reading the text file line by line: At first, I have an empty dictionary then to that I...
Modify your program from Learning Journal Unit 7 to read dictionary items from a file and write the inverted dictionary to a file. You will need to decide on the following:How to format each dictionary item as a text string in the input file.How to covert each input string into a dictionary item.How to format each item of your inverted dictionary as a text string in the output file.Create an input file with your original three-or-more items and add at...
use
python code complete this question
'Assignment 3 o Get information until getting 'n' from user Input the name of 1th student : 84 Input the math score of 1th student : 90 Input the english score of 1th student : 80 Input the science score of lth student : 100 Keep moving? (y/n): y Input the name of 2th student : 981 Input the math score of 2th student : 70 Input the english score of 2th student :...
Must be in Python 3
exercise_2.py
# Define the Student class
class Student():
# Initialize the object properties
def __init__(self, id, name, mark):
# TODO
# Print the object as an string
def __str__(self):
return ' - {}, {}, {}'.format(self.id, self.name, self.mark)
# Check if the mark of the input student is greater than the
student object
# The output is either True or False
def is_greater_than(self, another_student):
# TODO
# Sort the student_list
# The output is the sorted...
For my computer class I have to create a program that deals with
making and searching tweets. I am done with the program but keep
getting the error below when I try the first option in the shell.
Can someone please explain this error and show me how to fix it in
my code below? Thanks!
twitter.py - C:/Users/Owner/AppData/Local/Programs/Python/Python38/twitter.py (3.8.3) File Edit Format Run Options Window Help import pickle as pk from Tweet import Tweet import os def show menu():...
I am having trouble with my Python code in this dictionary and
pickle program. Here is my code but it is not running as i am
receiving synthax error on the second line.
class Student:
def__init__(self,id,name,midterm,final):
self.id=id
self.name=name
self.midterm=midterm
self.final=final
def calculate_grade(self):
self.avg=(self.midterm+self.final)/2
if self.avg>=60 and self.avg<=80:
self.g='A'
elif self.avg>80 and self.avg<=100:
self.g='A+'
elif self.avg<60 and self.avg>=40:
self.g='B'
else:
self.g='C'
def getdata(self):
return self.id,self.name.self.midterm,self.final,self.g
CIT101 = {}
CIT101["123"] = Student("123", "smith, john", 78, 86)
CIT101["124"] = Student("124", "tom, alter", 50,...
need help debugging please
need to know why isn't running and how to fix it
Users\trinv\Downloads\Test 3_Debugging Question(1).py - Notepad++ dit Search View Encoding Language Settings Tools Macro Run Plugins Window? ha LJ P2py x Test3 Plpy x B new i py Test_3_Debugging Question(1) py ") 6 str = input("Enter some text: ") 7 8 9 while (a < 0): 0 print(a) 1 a = a - 2 2 3 print(" 4 # # -5 26 for kin [1, 2,...
A) Please implement a Python script to define a student class with the following attributes (instance attributes): cwid: student’s CWID first_name : student’s first name last_name: student’s last name gender: student’s gender gpa: student’s gpa Please make these attributes as private ones so they have to be accessed via getter/setter methods or property. For this purpose, please define a getter/setter method and property for each of the attributes. Another thing you need to do is to define a constructor that...
Something is preventing this python code from running properly.
Can you please go through it and improve it so it can work. The
specifications are below the code. Thanks
list1=[]
list2=[]
def add_player():
d={}
name=input("Enter name of the player:")
d["name"]=name
position=input ("Enter a position:")
if position in Pos:
d["position"]=position
at_bats=int(input("Enter AB:"))
d["at_bats"] = at_bats
hits= int(input("Enter H:"))
d["hits"] = hits
d["AVG"]= hits/at_bats
list1.append(d)
def display():
if len(list1)==0:
print("{:15} {:8} {:8} {:8} {:8}".format("Player", "Pos", "AB",
"H", "AVG"))
print("ORIGINAL TEAM")
for x...