Archie
Archie

Reputation: 95

Having multiple things in input

If I want to put

This is the 1 sentence, write a number: 5

This is the 2 sentence, write a number: 10

I don't want the input to appear on a different line.

This is the 1 sentence, write a number:

5

This is the 2 sentence, write a number:

10

The code I have is

number = 1
print("This is the", number, " sentence, write a number:")
guess = input()
number = number + 1

it works but it writes the input on a different line. I've also tried doing it all under the input

number = 1
input("this is the", number, " sentence, write a number:")
number = number + 1

or even using the input(print('blahblah')) but that's returning None message?

Upvotes: 0

Views: 41

Answers (1)

midori
midori

Reputation: 4837

You can do it like this:

guess = input("This is the " + str(number) + " sentence, write a number:")

Upvotes: 1

Related Questions