General Programming Thread
I don't understand what is wrong with my code. Anyone able to shed some light?
>pic related
>It's python
shameless self bump
General Mills Thread
General Discontent Thread
The problem is that you're using Python
>>674865958
General MacArthur Thread
>>674867172
Also that you're not using an IDE
General Misuse Thread
>>674865958
print(add(n1, n2))
you forgot a parenthesis
>>674867535
Looks like this to me
General Disaster Thread
>>674865958
You're trying to run numbers before you've even ran main. Also make the variables floating points.
General Knowledge Thread
>>674867659
>>674867535
This, but he is also trying to run add before main which is like asking for the answer before there is even a question
Also this is python so you don't need parentheses around simple logic tests in your if statements
>>674865958
+ is in your "not in array" l.7
missing parenthesis on l.14
>>674865958
This is how you should correctly orientate your code famo, ive had to do that assignment at uni before, don't worry you'll get there.
>>674865958
Use C or anything other than a scripting language.
>>674868686
Are you retarded? He asked for help on his code not a suggestion on another language to learn. C is the most overused language and in the least demand in the workplace.
>>674868892
No but clearly he's retarded for forgetting a parenthesis.
C builds character. It breaks you down so you can build yourself back up again.
>>674867369
The only IDE you should need is a shell.
Vim 4 lyfe!
>>674869105
>C builds character.
No going out and getting fucked up builds character.
>>674865958
wait , why are you spending time on this, weren't le indians supposed to take these jobs and make average pay $26000/year???
>>674869199
Faggot. Sometimes you actually need an IDE.
>>674869316
Oh, and C isn't the programming equivalent of getting fucked up? I mean, besides mindfuck.
>>674868018
Thats fine in Python, Definitions can happen where-ever so long as your white-space is correct............. I think.... Its been a while
Use an IDE. It's the missing closing ). If you had Line numbers on, it would be obvious.
>>674865958
well its python, so its automatically shit
>>674869744
It's still good practice
>>674865958
Your first mistake was relying on functions to run your program. It's much better to use a for loop, as it helps avoid recursion and stack overflow errors.
>>674868892
>C is the most overused language
>Least in demand in the work place
Pick one dumbass.
C is always going to be in demand by the way.
>>674871051
>relying on functions
>relying
>has 2 functions
>relying
>use a for loop
I'm quitting programming
>>674871289
Yeah, what? Why the hell would he use a for loop? The program doesn't loop.
You can't run the main like that you need to use:
if __name__ == "__main__":
main()
to run it
>>674871161
Oh my god you dense fucker. C is the least in demand because it is the most over used & the market is saturated.
>>674871817
Yet VB .net is the best language out there and it pays less..
>>674871817
See? OP needs to learn ruby. Fuck python.
>>674871522
Ah my bad.
Yeah but in the event you want to make the program do multiple calculations you probably should use a for loop instead of a main function. Unless you wanna go to superior C++.
>>674865958
>invailed
>>674872407
I don't think this is really supposed to be a practical application, more like babby's first program. otherwise, you would just want to apply PEMDAS recursively, to make something practical.
OP might not have even been introduced to looping yet.
>>674871817
You're an idiot.
Less popular languages == more job security and more money.
You know why? You dumbass liberal cuck?
Basic economics.
Supply and demand. You have a plethora of people flocking to LE EBIN POPULAR MEME LANGUAGES XD so if there's more people offering a service, the price of it goes down and the person is less valuable.
There's less peopel in the lower bracket languages so they're more valuable and sought after and companies want to keep them.
These jobs are hard to find but they are easy as fuck to keep, because it's mostly maintaining a decade old database written in an old ass language that is too big to port to a newer and quicker one.
Also, you shouldn't learn a language just because it's more popular. That's reddit tier logic. Learn it to add more tools to your toolbox and increase your knowledge on programming and to learn programming paradigms, you fucking mindless dense oop faggot.
Go learn Haskell to learn functional programming, and pick up a book on Reversing to learn some low level concepts. After that you'll be 10x more knowledgable than your average r/programming fag or /g/ fool.
>>674871817
who the fuck made this chart, its terrible
>>674872840
i was literally showing the kid that C is a saturated market. That was some mega cringe reply. "Go pickup a book on some low level concepts", god i bet you were a right laugh at uni.
>>674873846
I didn't go to uni, and I'm working in a 70k job after going to a small computer class to get an entry level job.
Are you upset you inferior comp sci manlet?
I bet you don't even know how your code works.
change
> op = input(...)
to
> op = faggot
>>674874337
ethical hacking masters @ cov uni in the uk mate
>>674868018
confirmed, doesnt understand definitions vs execution
>>674865958
are you still working on shit? I'm bored as fuck.
>>674870989
What? No it's not. You almost always define helper functions above main functions. In fact in other languages you have to define them first, otherwise your code won't know what the hell the function is by the time you call it.
>>674871762
Yes you can, and no you don't.
>>674867172
>>674869880
I don't understand who could say this.
>>674876813
I only use VB .net. Every other language has stupid curly braces and shit and it's hard to understand. I literally don't understand why everything isn't done in VB .net
>>674876930
but...python doesn't use curly braces...
>>674877101
Yes but it uses colons instead of logical words like VB .net uses. VB .net is the best language out there. It's basically a fact at this point
>>674877277
...but...python uses logical words, too
>>674878631
...I can't tell if you're actually getting baited.
>>674879253
but python has baiting too
>>674878631
>>674879253
VB .net is way more intuitive. Even C# has to copy it but with braces and shit kek
>>674865958
second last line you have a colon ( : ) instead of a semi-colon ( ; )
>>674879894
you don't python much do you
>>674879831
python is intuitive too