-1

I'm using Python 3 and I can't seem to figure out how to print something from an input and the thing that they input.

var = input("Enter something: ")
print("you entered")

I have something along these lines, and I need the print function to print "you entered" and what they input.

martineau
  • 119,623
  • 25
  • 170
  • 301
Reed Johnson
  • 142
  • 1
  • 1
  • 7
  • possible duplicate of [How do you read from stdin in Python?](http://stackoverflow.com/questions/1450393/how-do-you-read-from-stdin-in-python) – l'L'l Feb 28 '15 at 02:49

4 Answers4

0

The answer is this:

var = input('Enter something:')
    print("You entered: %s") % (var)

This could also be done in one line:

print ("You entered: %s"%input('Enter something:'))
Katpoes
  • 209
  • 1
  • 11
0

What you input is stored in var, you need to %var to print what you input.

var = input('Enter something:')
print("You entered %s"%var)
michael_stackof
  • 223
  • 3
  • 12
0

The answer to your problem is to do this.

Here is what you are doing:

var = input("Enter something: ")
print("you entered")

Here is what you want to do:

var = input("Enter something:")
print("You Entered: %s") % (var)

You can also try this:

var = input("Enter something:")
print("You Entered:", var)

Or this:

print ("You entered: %s"%input('Enter something:'))

Hope this helps.

-1

definitely answer should be

var = input('Enter something:')
print("You entered %s"%var)

you should print the var to see it as a out put