can someone tell me why i am getting this error on such a simple line of code?
thanks.
>>54932747
>windows 10
>>>/v/
t. windows 7 user
>>54932747
>windows
>cant even do hello world in python
kill yourself
twice
>>54932762
He's a windows 10 cuck too.
>>54932762
dude come on, i know its terrible but atleast help me
>>54932760
its windows 8.1 bih
>>54932747
trystr(input("What is your name?"))
>>54932747
Works on My Machine (TM)
>>54932804
>>>/reddit/
>>54932747
your inputStream doesn't default to string...which is weird since python should take any terminal input as string...
try typing "martin" w/ quotes in your input
OR doing what >>54932811 says
OR doing print(str(myName) on line 3
Stop using python 2.
>>54932747
>being named martin
>using windows
>using notebad++
>using python
can you get any more pleb?
>>54932892
>print(str(myName)
fucking hell I am too used to auto closing parenthesis..... this is coming from someone who wrote code on paper for engineering meetings back in the day... QA really is the death sentence of all software engineering skillsets
>>54932747
You're probably using python2. Try using "raw_input" instead of "input" and avoid guides that use python3 because confusing shit like this will keep happening.
>>54932892
>>54932811
It's not going to even get that far. In python 2, input() tries to evaluate the input string.
OP wants raw_input. Well he really wants to use python fucking 3 already. It's been how many years and idiots still try to push python 2's shit down newbies' throats?
>>54932747
You're using Python2, where input is equivalent to eval(raw_input(prompt)).
>>54932747
You need to update python. It's out of date.
>>54932747
You need to install Gentoo. Windows is out of date.
use raw_input()
>>54933042
oh I see, automatically assumed python 3 due to
>print("hello world")
instead of print "hello world"
fucking python
>>54932747
>This is /g/
use raw_gentoo()
print("Hello world")
my_name = raw_input("What is your name?")
print(my_name)
Python 2.7.10 (default, May 23 2015, 09:44:00) [MSC v.1500 64 bit (AMD64)] on wi
n32
Type "help", "copyright", "credits" or "license" for more information.
>>> input.__doc__
'input([prompt]) -> value\n\nEquivalent to eval(raw_input(prompt)).'
>>> i = raw_input("name?")
name? martin
>>> i
' martin'
>>> i = input("name?")
name?martin
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<string>", line 1, in <module>
NameError: name 'martin' is not defined
>>>
>>54932747
if u want to do this stuff quit windows asap
>>54933251
I think input() only takes in int.
>>54933026
>>54933058
ah yes that was the issue, i uninstalled python 2 and got the new version and it worked well
thank you all
Your problems are
>not using raw_input
>using python
>using notepad++
>using Windows
Solution
>kill yourself
Or
>choose a different field
>>54933293
>using Python 3.x
I have lost all respect I had for you
>>54933293
>uinstalled python 2
>installs python 3x
lol
>>54933338
whats wrong with that? why not use the most up to date?
>>54933321
>>54933338
>using a deprecated language that performs worse and has more design inconsistencies
>>54933365
In words of Zed Shaw:
"When all the Python
code on your computer is Python 3, then I’ll try to learn it"
>>54933379
>implying any of what you just said is true
Fuck off you wannabe cunt
>>54933461
>oh look there's still FORTRAN on my computer, who needs a newfangled language like C?
>there are people in my country ____ who speak language _____, why learn english?
The only reason to still use python 2 is libraries that are still not fucking ported to python 3 and old codebase that would be too much of a mess to port. Python 3 is better. They have fixed things. Stop the fanboyism.
Also Learn X The Hard Way is one of the worst ways to learn programming. Only slightly better than codecademy
>>54933638
what's the best way to learn coding then?
>>54933661
By coding
>>54933677
how can I code If I don't know how to code?
>>54933661
think of something you wanna do
>game programming
>a website that does shit
>something that pays your bills for you
then code that shit.
Rise, repeat
>>54933694
Install gentoo
>>54933694
Babies figure out how to walk without a manual.
I don't know if you've gotten a decent answer, anon but here's what's going wrong
from the documentation of the input() function (https://docs.python.org/2/library/functions.html#input):
>Input([prompt]) [is] Equivalent to eval(raw_input(prompt))
So what's happening is that your program is seeing your input `martin` and attempting to execute that as python code. This is not what you're trying to do, so input() is the wrong function to use in this scenario. raw_input() is what you want
https://docs.python.org/2/library/functions.html#raw_input
>>54932747
OP, try;
print("hello world")
myName = raw_input("what is your name? ")
print(myName)
use raw_input
>>54932747
really tho? anyway, because of differences in python versions, you should lettuce know what version you're using. I'm suspecting a >2.7, but not 3.x