+ 1

Can anyone solve this python queues problem?

Python Data Structures - 24.2 Practice - On a Call

13th Jul 2021, 3:20 PM
Yash Sawant
5 ответов
+ 2
Whenever you call c.next() the last element is dropped. If you compare c.next() == "general" then the last element is dropped even if it's "technical". Then thebelif-part is evaluated: again, the last element is dropped. All this before the next iteration of while loop. So in this case you drop one too many.
13th Jul 2021, 3:51 PM
Lisa
Lisa - avatar
+ 3
while not c.is_empty(): tem = c.next() if (tem == 'general'): total += 5 elif (tem == 'technical'): total += 10 else: pass print(total)
13th Jul 2021, 4:08 PM
JaScript
JaScript - avatar
+ 1
Probably we can solve it :) Please link your code attempt and explain the task!
13th Jul 2021, 3:27 PM
Lisa
Lisa - avatar
+ 1
Lisa have commented the problem statement in the code above
13th Jul 2021, 3:35 PM
Yash Sawant
13th Jul 2021, 3:35 PM
Yash Sawant