PygLatin 3.Input! explanation needed

Instructions:
On line 4, use raw_input(“Enter a word:”) to ask the user to enter a word. Save the results of raw_input() in a variable called original.
Click Save & Submit Code
Type a word in the console window and press Enter (or Return).
?

I now know the correct way to enter this information is

print ‘Welcome to the Pig Latin Translator!’

Start coding here!

original = raw_input(“Enter a word:”)

But I’m confused because in my head I feel like it should be:

print ‘Welcome to the Pig Latin Translator!’

Start coding here!

raw_input(“Enter a word:”)
original = raw_input()

My reasoning is that it doesnt make sense for me to assign a variable to something that at that point hasnt been created yet (the raw input itself). Can anybody explain why we do it one way and not the other in a way that would make sense to me? I am VERY new to this, and would really appreciate the input.

raw_input is function so if you do original = raw_input() it expect some arguments in (), you are trying to use raw_input like variable

you can do this

input = raw_input("Something: ")
original = input

hope I understood your confusion and explained it

1 Like

raw_input() function reads a line from input (i.e. the user) and returns a string by stripping a trailing newline.
If the prompt argument is present, it is written to standard output without a trailing newline.
The syntax is for your code :

original = raw_input("Enter a word:")
print original 

example :

1 Like

you did, thank you for clearing that up for me! :grin:

I got tripped up on the instruction “Save the results of raw_input() in a variable called original .”

I think I understand this a little better.

" File “python”, line 7
else:
^
SyntaxError: invalid syntax"

I keep getting this error for this exercise, even though when I compare with the code solution there are no differences. I have even reset and started over 3x. It just keeps saying “Oops! Did you accidentally delete the variable called original?”

Can someone please assist me?

Wow, the last comment was right before covid 19 lol… ): I miss when the world was normal