Комментарии:
l1=[]
l2=[]
for i in range(int(input("Enter how many students: "))):
name=input("Enter your names: ")
marks=float(input("Enter numbers: "))
l1.append([name,marks])
l2.append(marks)
l2=list(sorted(set(l2)))
lo=l2[1]
l3=[]
for i in l1:
if lo==i[1]:
l3.append(i[0])
l3.sort()
for i in l3:
print(i)
my programme
Thank you Excellent teaching.
Instead of using another FOR LOOP in the end to just sort the names, we can use,
for val in sorted(res):
if m==val[1]
print(val[0])
mark = float(input())
EOFError: EOF when reading a line.
I am getting like this sir plz give me solution
recently started learning to code, this was a way better explanation compared to other sources. thanks /\
Ответитьfinished watching
ОтветитьYou have made coding so easy.Thankyou so much
Ответитьthx a lot
ОтветитьThank you sir
Ответитьnice explanation sir.....
ОтветитьReally nice explanation
Ответитьthe explanation is clear, awesome
Ответитьvery well explained
Ответитьi really like the way of your explanation .... you explanation is mind blowing........😇😇😇
ОтветитьYou are a great teacher! What a nice explanation!
ОтветитьGreat job there. Although I used a different method, your video helped me to link the least with the student name:
(it got only 7/10 but I'm happy that my own idea worked little. I'll use your idea to improve mine :) )
if _name_ == '__main__':
n = int(input("Enter number of students: "))
data = [] # list of name and score
jscore = [] # list of just the score
for i in range(1, n+1):
name = str(input(f"Enter name of student {i}: "))
score = float(input(f"Enter the score of student {i}: "))
lis = [name, score] # to temporarily store each student data entry
data.append(lis) # added to data list
for student in data:
jscore.append(student[1]) # just the list of scores
least1 = min(jscore) # first least score
while least1 in jscore:
# to remove first least score even if it's present multiple times
jscore.remove(least1)
least2 = jscore[0] # second least score
names = [] # to store names of students who have second least score
for student in data:
if least2 == student[1]: # matching second least score to students in data list
names.append(student[0])
for person in (sorted(names)): # sorting alphabetically and printing each name in new line
print(person)
loved the way of explanation
Ответитьcarry on 😌
Ответить❤🙏
ОтветитьHi
can someone explain the code from line number 16.
I'm not clear with the val is being accessed with the indexing in the nested loop. To access element in nested loop won't it be. How will the for loop iterate with val in res?
to access the first val in res. won't we write to access the first element inside the inner list:like val[0, 0]
why am I getting this IndexError: list index out of range
ОтветитьVery well explained 🙌🏻❤️
ОтветитьGreat explanation
ОтветитьThank you man!
Ответитьgood explained. Thank you
Ответитьnice bro thanks for clarity🥰
ОтветитьWow!!! how perfectly you explained each line of the code ,you explained all the logic behind each line so perfectly. Thankyou so much for the explanation. 😇
ОтветитьExcellent teaching bro. Really I see so many but I can't understand .. once saw your video clear cut explanation.....do like this way of teaching
ОтветитьWow amazing and simple concept . thanku for your great explanation
Ответитьexcellent explanation sir but ..while submitting code test case 3,4,6,9 are getting failed
Ответитьbhai kya bath hai yaar you're amazing
ОтветитьVery neatly explained. Thank you
Ответитьhigh quality content. thank you so much
ОтветитьThank you so much sir . The way you explain really cool . 😇🙂
Ответитьthanks sir its really goad explanation for every one to understood code easily. and its very helpfull for me . u are great
Ответитьthank you very much bro
Ответитьexcellent. but this code do not run if there are multiple high grades.
ОтветитьNice explanation I searched everywhere but all were shortcuts, thanks a lot
ОтветитьThank you so much for this easy explanation!
ОтветитьThank you
It was very easy to follow.
thanks bro 👍🏻
ОтветитьThank you
ОтветитьThanks for such a wonderful explanation. I very much happy after seeing such a video. Thanks
ОтветитьTqs bro for explaining in a clear manner 👏👏
Ответитьthank you brother.... its really helpful to understand
ОтветитьI am getting error . will u please help?
n=int(input())
res=[]
grade=[]
for i in range(n):
name=input()
score = float(input())
res.append([name,score])
grade.append([score])
grade=sorted(set(grade))
m=grade[1]
name=[]
for val in res:
if val[1]==m:
name.append(val[0])
name.sort
for i in name:
print(i)
Error:
grade=sorted(set(grade))
TypeError: unhashable type: 'list
Thank you so much..really really well explained
Ответитьgood explaination
Ответить