-
Notifications
You must be signed in to change notification settings - Fork 0
/
assignment6-2.py
67 lines (67 loc) · 2.05 KB
/
assignment6-2.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<<<<<<< HEAD
#question_1
dict=eval(input('Enter value '))
print(dict)
for key in dict:
print('key for the value {} is {}'.format(dict[key],key))
#question_2
d=dict()
marks=dict()
Mks=list()
Final=list()
n=int(input("students"))
for i in range (0,n):
Name=input("Students Name ")
Python=int(input("Marks in abc "))
Java=int(input("Marks in xyz "))
Cpp=int(input("Marks in pqr "))
D={'Name':Name.upper(),'Marks':{'abc':Python,'xyz':Java,'pqr':Cpp}}
Final.append(D)
print(Final)
N_Find=input("Name of the student to find Marks ")
N_Find=N_Find.upper()
for i in range (0,len(Final)):
if(N_Find==Final[i]['Name']):
print("name of the student is : %s" %Final[i]['Name'])
print("marks of the student in abc are : %d" %(Final[i]['Marks']['abc']))
print("marks of the student in xyz are : %d" %(Final[i]['Marks']['xyz']))
print("marks of the student in pqr are : %d" %(Final[i]['Marks']['pqr']))
break
else:
continue
else:
print("Student Not Found")
=======
#question_1
dict=eval(input('Enter value '))
print(dict)
for key in dict:
print('key for the value {} is {}'.format(dict[key],key))
#question_2
d=dict()
marks=dict()
Mks=list()
Final=list()
n=int(input("students"))
for i in range (0,n):
Name=input("Students Name ")
Python=int(input("Marks in abc "))
Java=int(input("Marks in xyz "))
Cpp=int(input("Marks in pqr "))
D={'Name':Name.upper(),'Marks':{'abc':Python,'xyz':Java,'pqr':Cpp}}
Final.append(D)
print(Final)
N_Find=input("Name of the student to find Marks ")
N_Find=N_Find.upper()
for i in range (0,len(Final)):
if(N_Find==Final[i]['Name']):
print("name of the student is : %s" %Final[i]['Name'])
print("marks of the student in abc are : %d" %(Final[i]['Marks']['abc']))
print("marks of the student in xyz are : %d" %(Final[i]['Marks']['xyz']))
print("marks of the student in pqr are : %d" %(Final[i]['Marks']['pqr']))
break
else:
continue
else:
print("Student Not Found")
>>>>>>> bfc3136c57691ea7819b922d050eafb8166273dd