Skip to content

YasinSinan/2.week-solutions

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 

Repository files navigation

2.week-solutions

students = {"Ahmet Yilmaz": [85, 90, 78], "Mehmet Demir": [92, 88, 76], "Ayşe Kaya": [78, 89, 95], "Zeynep Çelik": [65, 70, 80], "Ali Kara": [50, 60, 55], "Fatma Yıldız": [88, 85, 90], "Murat Aydın": [72, 68, 74], "Elif Aksoy": [75, 90, 88], "Hakan Öztürk": [45, 50, 55], "Canan Taş": [80, 75, 82]}

for i, j in students.items(): gpa = sum(j) // 3 students[i] = [j, gpa]

print(students[i])

print(students)

{'a': [[65, 75, 70], 70], 'b': [[60, 70, 80], 70], 'c': [[80, 75, 80], 78], 'd': [[75, 80, 90], 81],'e': [[55, 60, 75], 63],

'f': [[45, 60, 70], 58], 'g': [[60, 75, 80], 71], 'h': [[75, 80, 90], 81], 'i': [[80, 80, 90], 83], 'j': [[40, 55, 60], 51]}

2-Find the student with the highest GPA and print it on the screen.

gpalist = [i[1] for i in students.values()] # Comprehension GPAs for finding the highest

for i in students.values():

gpalist.append(i[1])

highgpa = max(gpalist)

for i in students: if students[i][1] == highgpa: print(f'Student {i} has the highest GPA with {highgpa}')

3- Separate each student's name from their surname and store them in a separate tuple and add them to a list.

namelist = [] for i in students.keys(): namelist.append(tuple(i.split())) print(namelist)

4-Sort the names in alphabetical order and print the sorted list on the screen.

namelist.sort() print(namelist)

5-Keep students with a GPA below 70 in a cluster (set).

below70 = {i for i in students if students[i][1]<70} print(below70)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors