0

how to solve this?

Complete the code to iterate through the grades list and display only values greater than 50 for grade [in] grades: if grade <= 50: [ ] print(grade)

28th Jul 2024, 7:01 PM
Максим Ратов
Максим Ратов - avatar
6 Antworten
+ 6
for grade in grades: if grade > 50: print(grade)
28th Jul 2024, 8:25 PM
Jan
Jan - avatar
+ 2
Stop that iteration and go on with next one. What do you think: break or continue?
29th Jul 2024, 7:14 AM
Oma Falk
Oma Falk - avatar
+ 2
Oma Falk Maybe or maybe not, because SL sometimes add some messy code that doesn't make sense in order for the user to learn how to correct the mistakes.
29th Jul 2024, 11:34 AM
Jan
Jan - avatar
0
I'll be back when I reach that task to find out if there should be any breaks or not!
29th Jul 2024, 11:03 AM
Jan
Jan - avatar
0
Jan I think, the brackets have to be filled.
29th Jul 2024, 11:14 AM
Oma Falk
Oma Falk - avatar
0
for grade in grades: if grade <= 50: continue print(grade) since we don’t have any additional conditions, we simply set a continuation.
9th Oct 2024, 11:40 AM
Aleksejs Smirnovs
Aleksejs Smirnovs - avatar