Needing help!

python

#1

I am a brand new python learner and need help on this example!

x = "Hello"
y = "World"
print x + y

I’m being asked to put a space between Hello and World in order to separate the two words when printed. My thought process was to add a physical space before World like so: " world" but that failed me.

Any help?


#2

that should work, is this on your own or a exercise? If its an exercise, it might desire the space after hello


#3

hey there! yes an exercise. I tried both ways and nothing has worked so far :confused: could be a glitch in the exercise i’m using


#4

What exercise are you doing/using? Can you share it with us? Is it a codecademy exercise?


#5

It is! it’s the “Teaching yourself python” lesson and I am on math and strings where it asks you to print x + y as “Hello World”

Thanks!


#6
x = "hello"
y = " world"
print x + y

this is what I have! I have tried doing the space after "hello " as well with no luck…


#7

Please just give me the exercise url, that is easier

the code you posted didn’t include that you added the spaces within the hello string


#8

https://www.codecademy.com/courses/python-beginner-en-fymF4/2/3#


#9

that course is longer supported, i really recommend upgrading to the supported python course:

https://www.codecademy.com/learn/learn-python


#10

will do! thank you. So the space should work then? Just wanting to make sure I was at least doing it correctly.

Thanks!


#11

yes, it would normally work. Also, note that Hello and World both start with an uppercase letter.

it seems the only way to pass is to do something like:

x = "Hello"
y = "World"
print "%s %s" % (x, y)

its weird, the exercise checks that the value of x is Hello and the value of y is World. So, you need an alternative way to get the space in, given we can’t add it to the variables

but continuing this course will very likely mean running into more bugs, so change to the new course