+ 1
Could anyone tell me why test case 4 Is showing error in code coach problem named "Land Ho!"???I am not a pro user!
people=int(input()) if people<20: print(10) elif people>=20 and people%10==0: print(people+10) elif people>=20 and people%10!=0: if round(people,-1)<people: print((round(people,-1))+10) else: print(round(people,-1))
9 Respuestas
+ 3
If there are 30 people, then you're saying the wait time is 40 mins?
+ 3
Then your logic is incorrect.
First 20 people leave and the boat returns = 20 mins.
I can go on the second boat, so I leave with the second group = 10 mins
Total = 30 mins
+ 3
The boat can take groups of 20 people. Each group needs to wait 10 minutes to get there.
Group 1 [20] = 10 mins
Group 2 [40] = 30 mins
Group 3 [60] = 50 mins
Group n [n*20] = n*20-10mins
+ 3
Well done Vaibhav Pandey I'm happy you got there
+ 1
Vaibhav Pandey , I'm write this code very simple:
people=int(input())
if people <=20:
print(10)
else:
wait=(people//20)*20+10
print(wait)
0
Ausgrindtube yes bro
0
Ausgrindtube how is this incorrect bro i didn't understand??
0
Ausgrindtube nah bro u see test case 2 is not matching your code the input in test case 2 is 80 and output is 90 whereas in your code if i input 80 it will be 70.
0
Ausgrindtube done bro i did it
people=int(input())
if people<20:
print(10)
elif people>=20 and people%20==0:
print(people+10)
elif people>=20 and people%20!=0 and people%10==0:
print(people)
elif people>=20 and people%20!=0 and people%10!=0:
if round(people,-1)<people and round(people,-1)%20==0:
print(round(people,-1)+10)
elif round(people,-1)>people and round(people,-1)%20==0:
print(round(people,-1)+10)
elif round(people,-1)>people and round(people,-1)%20!=0:
print(round(people,-1))
elif round(people,-1)<people and round(people,-1)%20!=0:
print(round(people,-1))