Ask coding questions

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

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

Commentshotnewtop
ash15khng (405)

What's the problem with this code?

JacksonOnSticks (6)

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 (405)

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

JacksonOnSticks (6)

Be more specific to what line to indent pls
@ash15khng

JacksonOnSticks (6)

IDK what line ur talking about :(@ash15khng

ash15khng (405)

@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 (1)

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

MarsExplorer (1)

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 repl.it update

mwilki7 (292)

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 (0)

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