Move it on Back


#1



Replace this line with your code.

**_This is a little frustrating because I thought that when you concatenate there is suppose to be quotation

Blockquote

marks and a space after every word except the last word. However in this example in code academy it did not require for one to use the quotations marks or spaces. So which way is correct #OhPython #Help_**

EX:
example = "The " + "dog " + "is " + "big"


#2

Codecademy's way is just fine. Since they expect that you're going to only type one word, that word will be modified (in your code) so it can look like the pyglatin version.

You can't put spaces when ONLY concatenating variables. If you were to do this (adding spaces), you could just add (+) and an empty string, but that's not needed here. :slight_smile:


#3

Forgive me for my elementary knowledge but can you give me an example in a case where you use the spaces and quotation marks and in a case where it is not necessary.

I see 3 words
word + first + pyg
i though it suppose to be like
"word " + "first " + "pyg"


#4

Nope, now you're just printing strings, not the contents of the variables.

Well actually, this is going to be one whole word. Let's see what happens:

word + first + pyg
  • word, whats in it? well, word contains the lowercase (lower()) version of original. (look at line 2 of your code)

  • first, contains the first letter of your input. If I typed mood, first would hold a copy of the first letter of my word: m. This will not remove the first letter of mood. (Look at line 3)

  • pyg, well, this is an easy one. pyg contains 'ay'. (look at line 1)

Now, if we print new_word, we get:

=> moodmay

If you were to add spaces, you could do this:

letter = "A"
noun = "tree"
animal = "frog"
print letter + " " + noun + " " + animal 
#output: A tree frog

This isn't really necessary... You could just print:

print "A tree frog"

and it will only take one line of code.

Now, if you were to make a tiny program that repeats your name, we could do this:

name = raw_input("name:")
print "Oh hi " + name + "!"
#output: Oh hi billybob!  
#(whatever name you choose)

this is useful because you can type something different every time and make Python say a sentence! :smiley:
Does this help?


#5

Thank you.
This is like a puzzle your moodmay example helped alot.

It is more clear now.
Thanks


#6

Sure, you're welcome! :smiley: I'm glad the example helped :slight_smile:


#8

@intermediategamer, perhaps you can provide some insights.

In my experience, the directions are misleading as to what the process requires. Albeit, I was able to figure it out but, with some frustration.

For example, I would have to make errors within the code to first get to the proper translation. I had to write word = 'original.lower()' and hit save/submit before changing it to what was instructed, word = original.lower(). I thought only strings take on quotations, and as original has the .lower() function added it is not a string. Is this incorrect?

Afterwards, the code was still not recognized so I had to purposefully write first=word[1] to error out before changing to first=word[0]. Lastly, we were not instructed to print new_word which provides the translation in the console.


#9

I will gladly help you. :slight_smile: But do remember, instead of asking for help in someone else's topic, you can create a new topic like it's stated in the guidelines↓. :slight_smile: You are also welcome to PM me.

↓


#10

My apologies, @intermediategamer! This is my first time using codeacademy. I was not familiar with the community guidelines, nor do I know how to PM you directly. Could you please direct me to how I may PM you so that we can continue our dialogue?


#11

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.