Give me a hint please!! Not direct answer!! Why is the last loop not working? It prints zero as the total_time. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Give me a hint please!! Not direct answer!! Why is the last loop not working? It prints zero as the total_time.

https://www.sololearn.com/coach/1111?ref=app class CallCenter: def __init__(self): self.customers = [] def is_empty(self): return self.customers == [] def add(self, x): self.customers.insert(0, x) def next(self): return self.customers.pop() def pop(self): return self.customers.pop() c = CallCenter() while True: n = input() if n == 'end': break c.add(n) #your code goes here general = 0 technical = 0 while n != 'end': call = c.next() if call == 'general': general += 1 elif call == 'technical': technical += 1 c.pop() total_time = (general * 5) + (technical * 10) print(total_time)

31st Oct 2021, 1:15 PM
Neethu Nath
Neethu Nath - avatar
1 Answer
+ 6
Neethu Nath , ▪︎the main issue is the conditional in the while loop ▪︎if you have fixed it, a new issue may raise inside the loop like using c.pop() in general you should think about an other way instead of using a while loop...
31st Oct 2021, 1:45 PM
Lothar
Lothar - avatar