Ask coding questions

← Back to all posts
I have no idea what is wrong please help ASAP
JacksonOnSticks (7)

Ok so I'm new to all this coding stuff and I'm taking a class for coding and this is a grade and I really need help can someone please inform me to what my error is and how to fix it

ash15khng (486)

What's the problem with this code?

JacksonOnSticks (7)

Well when u enter your name then gender then address than say yes to us citezen it will ask u ur age if u say anything over 17 there is an error idk how to fix :/@ash15khng

ash15khng (486)

@JacksonOnSticks You can indent that line one time, because if not high is not created and high1 will crash the code.

JacksonOnSticks (7)

Be more specific to what line to indent pls

JacksonOnSticks (7)

IDK what line ur talking about :(@ash15khng

ash15khng (486)

@JacksonOnSticks When you run the code there will be an error with the line number. Indent that line.

goop0711 (2)

there's nothing there

SubarnaCoding (0)

Well you can convert the .py extension to .html by simply adding this '

<!DOCTYPE idiot>'<idiot>
<h1> </h1> </idiot>

nah just joking but seriously where is the code there is not a single line of code..

MarsExplorer (11)

change code to instead of automatically printing congrats, use a variable, and if variable, congrats. otherwise it can print congrats multiple times.

MarsExplorer (11)

part of this code is unnescessary, that may cause it to accaisionally glitch

HarryTubbs (0)

type ctrl alt delete all at once. It shows the mistakes. Its a new feature on the update

mwilki7 (635)

I recommend increasing the amount of indentation and spacing between if statements. It may help you spot errors more quickly.

ethan10022 (1)

I'm pretty sure the else statement in line 28 contradicts the if statement in line 30. This else statement says that if the age is anything greater than 17, the code breaks. You could try removing the else statement completely. I'll mess around with it and see if I can find something.

ethan10022 (1)

Also, I'm not quite sure what you want the code to detect, so it's hard for me to change anything to make it work better. I would try changing the else statement to a specific if statement, where if (whatever) isnt equal to (whatever2), it says goodbye. To ellaborate on the problem with the else statement, its saying that if you dont meet the parameters for age<17, it says goodbye. That means that even if your if statement for having an age of 18 or higher allows you to qualify, it won't go through due to the else statement before it. Also, your statements appear to be overly complicated. Your if statements have multiple parameters. Instead, you should make it so that it is impossible to proceed without meeting the parameters. for example, if you want them to be 16, 57 inches, and have completed high school, you make 3 seprate if statements. are you 16? if yes, how tall are you? if you are 57 inches, have you completed high school? then proceed from there. Hope this helps, reply if I didn't make any sense or you need more help. This is my first time replying to one of these, so sorry in advance if its confusing.

ethan10022 (1)

no problem, is it working now? @JacksonOnSticks

Michaelmikey (2)

You have your height in an if statement so it will only be called if that statement is True and you are using it other places