Can someone point out to me what is wrong with my code? My program won't run. It keeps saying "invalid syntax" and I don't know why. It doesn't even highlight anything.
def main(): notsnick=0 notchoc=0 eval (input("cookie?")) if input is snickerdoodle: print (yum) else: notsnick=1 if input is chocolate: print (yum) else: notchoc=1 if notsnick=1 and notchoc=1: main()
Lincoln Lewis
should also mention that it's python
also that i'm a noob to this
Nathan Morales
...
Jaxon Barnes
are you seriously converting people's images into webm to show smaller file sizes?
Daniel Jackson
You got me.
Ryan Torres
CUNT
Colton Ortiz
In your if statements , use == instead of = . also , use true or false instead of one or zero
Christian Wood
Nigga OP posted an image 38X bigger than it needs to be, you should be getting mad at him.
Colton Nguyen
I have literally never used python before but shouldn't your input comparisons be in double quotes? like input is "snickerdoodle"?
William Lee
Your else's shouldn't be indented
Yum is not defined (use quotes if you want to print the string)
Anthony Stewart
Its print("whatever you want to print")
At least for python 3.5
Adrian Rogers
>using = instead of == >not declaring variables before using them >not quoting strings >wrong indentation Back to basics my friend
Christopher Davis
What the fuck are you even trying to do here OP Why are you calling main() inside itself
Ayden King
>bigger than it needs to be
you can never go to big with reviewbrah
>true/false
why? what is the difference? just for clarity?
>back to basics
yeah, no shit m8. I told you I was a noob. I love it when you guys do that shit. Would I make fun of you because your neckbeard ass couldn't run a mile?
the program is supposed to repeat itself
anyway, this is what I have now. it runs at least, but when I enter the input, it brings up an error
def main(): notsnick=0 notchoc=0 eval (input("cookie?")) if input is snickerdoodle: print ("yum") else: notsnick=1 if input is chocolate: print ("yum") else: notchoc=1 if notsnick==1 and notchoc==1: main() main()
Andrew Reyes
Are snickerdoodle and chocolate supposed to be strings?
Also since your input can be either snickerdoodle or chocolate but not both at the same time, the recursion never hits
Levi Sanders
what do you mean?
the way I read the program, it asks for an input. then, if the inputted string/what is typed is "snickerdoodle", it will print "yum" and the program will end. if the inputted string isn't "snickerdoodle", it will set notsnick=1 for future reference.
the same goes with chocolate.
after checking both snickerdoodle and chocolate, if notsnick and notchoc equal 1, then that means I haven't typed "snickerdoodle" or "chocolate", and the program will repeat itself, starting from the beginning.
At least that's is how it's supposed to work.
Tyler Roberts
If you know you should go back to basics then why are you asking questions than can be answered by understanding basics? You asked for advice and I gave it to you. Nobody is going to hold your hand you sensitive little cunt. Do the fucking work like the rest of us.
Wyatt Rogers
Well, you got a type problem, which can be fixed simply but that's on you. The bigger logic question is: can your input string be snickerdoole and chocolate at the same time?
Also, your future reference will be gone as soon as the program ends
Oliver Johnson
someone's triggered. did you get bullied in school user? do you automatically hate anyone that doesn't have the same skills as you?
lol, grow up you aspergers retard.
nobody else seemed to have any problem with my questions, and they were happy to help with being an asshole like you.
>type problem
what do you mean? I've changed everything that people said need fixing. Actually, I just noticed thismy code looks like this now
def main(): notsnick=0 notchoc=0 eval (input("cookie?")) if input is "snickerdoodle": print ("yum") else: notsnick=1 if input is "chocolate": print ("yum") else: notchoc=1 if notsnick==1 and notchoc==1: main() main()
>can your input string be snickerdoole and chocolate at the same time?
I don't think so.
Christopher Ward
That's what I mean by type problem.
Now what do you think is the problem? Because I bet if you run it it's not going to run like you'd hoped
Dylan Lewis
You're the one who threw a tantrum because I suggested you reread the basics of Python and Programming. All the mistakes you made are all outlined in any beginner book or the Python documentation. The code you posted didn't have 1 or 2 small errors, it had a plethora of mistakes that shouldn't be made by someone who's spent an hour or 2 reading syntax. I'm sorry you lack the ability to google and build a foundation before writing programs. This isn't a your safe place.
Josiah Foster
fuckoff pls
John Lopez
ok, whatever m8. if you don't want to help, then just don't help.
>Now what do you think is the problem?
I don't know, I have no clue. That's why I'm posting here. Obviously there is something wrong with the code, but telling me "that's what I mean by type problem", without specifying what, in response to the same code that I already have, doesn't do anything in the way of helping me understand what's wrong.
>Because I bet if you run it it's not going to run like you'd hoped
once, again, that's why I'm posting here. I already know that it doesn't run correctly.
Sebastian Bell
Reddit might be more for you user.
Asher Collins
fuckoff pls
Ethan Diaz
Hey kid, I'm about the only one helping you out here, so maybe try to not chimp out because you can't handle the bantz I think I know exactly what's the problem, but since you're gonna act like a whiny brat I'm not telling you unless you post some tits
Gavin Thompson
>can't handle the bantz
but that's not even bantz, you just aren't helping.
>I think I know exactly what's the problem
yeah, no shit
fuckoff then.
I got better things to do, and there about 1000 other places on the internet I can get help with this.
>whiny brat
the sad part is, you might be autistic enough to believe that. people like you are generally incapable of seeing their own faults in social situations. maybe you got triggered when I said the whole aspergers thing?
see you then I guess. You won't be getting any tits from me. Or probably at all.
Henry Hall
Hope you wrote a bot for that or something
Dominic Sullivan
I see the point of this post now. Write some retarded piece of code to bait us into actually helping while you act like a faggot for the lulz. No one can be this stubborn when people are actually helping. Or maybe you're just a stubborn teenager.
James Watson
assing your input to something first and then make the comparisons use booleans for notsnick and notchoc also your variables will get overriden (with zero) when main() executes again
you should use codecademy or something other site for retard level exercises.
Levi Hill
You're using 'input' wrong.
A good mantra for any programming language supporting eval is "My code is using eval, so it is probably wrong".
Samuel Long
Do your own homework OP, stop sperging out on Cred Forums for an hour.
if resp == "snickerdoodle": notsnick = False print("yum")
if resp == "chocolate": notchoc = False print("yum")
if notsnick and notchoc: main()
main()
This is still not the best way to do this but it's close enough to your own code that I think you can understand how you should be doing things.
Jordan Thomas
Fuck off
Adrian Campbell
What?
Christopher Green
When a troll and/or retard comes to Cred Forums asking for homework on a really basic problem and is generally an autistic bitch to everyone, you don't just feed him a solution. It encourages him to come back the next time he can't handle something simple and shit up the board more
Ayden Rodriguez
Not same guy but do you really think not giving him the solution will somehow work? He's going to shitpost regardless of what we say.
Jaxson Powell
Shit up the board? I rather have 20 threads like these than "AMD VS NVIDIA #214365"
Gavin Ortiz
This
Adam Cook
>shit up the board more
>implying that this thread isn't more interesting than the 5659434098538945th AYYMD/NOVIDO BTFO thread
Jacob Evans
Or you can just drive him away with bantz
Kevin Nelson
>one type of shit thread exists >therefore all other types of shit threads are justified and cannot be criticized I want newfags to leave
Christopher Nguyen
Except in the "shit thread" spectrum this is nowhere near 90% of threads on Cred Forums.
Andrew Lee
Hey bro when are you going to tell hiroyuki to let us have webp