+ 2
Ticket Price
Hi there… somebody who can help me with the practice 26.3 (Ticket Price) I have some days trying to solve it and I can’t move on… I typed a code that works in my computer but doesn’t work in that number of practice. If someone can send me the code for that practice I will appreciate it.
5 Respostas
+ 9
Jonathan Payan Rodriguez ,
here is your code with comments, already corrected in this case. please compare it against your original code:
i=0
price=0
while True: # while has to be lower case
personas= int(input()) # wrong quotes // do not output any prompt!!
if personas >= 3:
price+= 100
i+=1 # wrong indentation
if i>=5: # wrong indentation
print(price)
break # break has to be in lower case
happy coding!
+ 4
Jonathan Payan Rodriguez ,
please do not ask the community to give you a ready made code. this does not really help you.
please post your code here, so that we can see where the issue is. it does not matter if it works not or not.
thanks!
+ 1
Ok let me post my code (python) and it is wird becase in spyder IDLE work very good according to the expectations or requirements ….
+ 1
i=0
price=0
While True:
personas= int(input(“Age: “))
if personas >= 3:
price+= 100
i+=1
if i>=5:
print(price)
Break
0
Post your code and we will find issue so you can learn from your mistakes. If we send you code you wont learn.
If test is not passed than you didnt write code for every case thay asked. Read again what thay ask you to do, maybe you forgot to add something.
Also what language is this, please tag language, code is not same for every language.