Coding Exercise for Beginners in Python with solution | Exercise 23 | Python for Beginners #lec68

preview_player
Показать описание
In this lecture we have discussed a Python Program to assign grade to students based on their marks using Dictionaries.

*********************************************

Connect & Contact Me:

*******************************************

More Playlists:

#coding #codingquestions #python #pythonforbeginners #jennyslectures
Рекомендации по теме
Комментарии
Автор

mam please upload regular vedios so many people getting benefited by ur vedios

jvjcfjo
Автор

Ma'am can't we do it in this way??

*Input*
student_marks={
"Jenney":92,
"Harry":78,
"Dimpy":56,
"Rahul":41,
"Aniket":99,
"Prem":34
}

student_grades={}

for marks in student_marks:
if student_marks[marks]>90:
grade="A+"

elif student_marks[marks]>80:
grade="A"

elif student_marks[marks]>70:
grade="B+"

elif student_marks[marks]>60:
grade="B"

elif student_marks[marks]>50:
grade="C"

elif student_marks[marks]>40:
grade="D"

else:
grade="F"

student_grades[marks]=grade

print(student_grades)

*Output*
{'Jenney': 'A+', 'Harry': 'B+', 'Dimpy': 'C', 'Rahul': 'D', 'Aniket': 'A+', 'Prem': 'F'}

aishwaryagandhi
Автор

Excellent explaination ma'am. Upload DAA classes please. I used to learn in your channel.

lyucmgv
Автор

initial_dict = {"Jenny": 92, "Harry": 78, "Surya": 62, "Rakul": 41, "Ajay": 99, "Prem": 34}
resultant_dict = dict()

for name, marks in initial_dict.items():
if marks >= 91 and marks <= 100:
resultant_dict[name] = "A+"
elif marks >= 81 and marks <= 90:
resultant_dict[name] = "A"
elif marks >= 71 and marks <= 80:
resultant_dict[name] = "B+"
elif marks >= 61 and marks <= 70:
resultant_dict[name] = "B"
elif marks >= 51 and marks <= 60:
resultant_dict[name] = "C"
elif marks >= 41 and marks <= 50:
resultant_dict[name] = "D"
else:
resultant_dict[name] = "F"

print(resultant_dict) 😀😀😀

ajaymichael
Автор

I am learning since Feb & now 4th sem ended with python

mr_affan
Автор

You are doing such an excellent job, keep up the great work!♥

MyCodingDiary
Автор

This is good, need more excercise videos like this which are practical and helpful for interviews. Thank you 🙏

nemeziz_prime
Автор

Btw, It's excellence videos to learn python with best explanation I have ever seen!!

pateldev
Автор

maam doing hard work 1 like to banta hai plzz everyone

edingsonlkalwing
Автор

Mam please upload atleast 2 videos everyday.

pateldev
Автор

this logic can be simply implemented using dictionary comprehension as well
student_grades = {}

student_grades = {key: [val, ("A+" if val in range(91, 100) else "A" if val in range(81, 90) else "B" if val in range(71, 80) else "C" if val in range(61, 70) else "D" if val in range(51, 60) else "E" if val in range(41, 50) else "F")] for (key, val) in student_marks.items()}

print(student_grades)

of course the if else can be in a function like this

student_grades = {name: [score, calculate_grade(score)] for name, score in student_marks.items()}

print(student_grades)

krishnayallapanthula
Автор

s_m={
"jenny":92,
"harry":78,
"dimpy":56,
"rahul":41,
"aniket":99,
"prem":34
}

for i in s_m:
marks = s_m[i]
if marks<40:
marks="F"
elif marks>=41 and marks<50:
marks="D"
elif marks>=51 and marks<60:
marks="C"
elif marks>=61 and marks<70:
marks="B"
elif marks>=71 and marks<80:
marks="B+"
elif marks>=81 and marks<90:
marks="A"
else:
marks="A+"
s_m[i]=marks
print(s_m)

rxpnjis
Автор

I don't learn coding but your video gives relax me ❤❤

parthaghosh
Автор

Madam I'm currently studying mca, I did bcom in graduation,
Should I prepare for gate 2025
Or try for job

raghuteja
Автор

Please start a series of cloud computing.

Sunil-tqcs
Автор

Mam I confuse during playing your vedio watching your face only beautiful

RajKumar-pvmi
Автор

Wait for all python classes please quickly posted python videos madam

rsuman
Автор

mam please take front end for the python (Django)

foodwithkalai
Автор

def student_grade(d1):
for key, value in d1.items():
if value >= 91:
d1[key] = "A+"
elif value >= 81:
d1[key] = "A"
elif value >= 71:
d1[key] = "B+"
elif value >= 61:
d1[key] = "B"
elif value >= 51:
d1[key] = "C"
elif value >= 41:
d1[key] = "D"
else:
d1[key] = "F"
return d1

chinenyeumeaku
Автор

A beautiful mind,
A beautiful career, a beautiful salary and a beautiful family?
What more do you want?

These blessings are a test, you've helped many people for their career and these videos will keep helping many more people but what about you?

Are you satisfied without knowing the truth? Are you sure that what you are following is truth?
At least, for the sake of the love you have for your family.. do some research on the one n only truth. Find the right path, it won't come to you if you don't try

Abdul_muntaqim