-3

I'm doing some coursework and I need to determine a character's name. This is what I have so far:

charOne=input("Please input your first character's name: ")
charTwo=input("Please input your second character's name: ")

So the user inputs the names, and now I need to ask the user to choose one of these characters.

chooseCharacter=input("What character do you want to use?"

I need to put the users charOne and charTwo into the question. Or some way need to make the user choose the user they want to use.

4
  • 2
    I'm not sure what it is you're asking here, can you go into more detail and show more of your code? Commented May 7, 2015 at 16:07
  • Yea, at the beginning the program asks what you want your name to be- charOne=input("Please input your first character's name: ") charTwo=input("Please input your second character's name: ") So you write two names (e.g michael, and wade) now i need to ask the user to choose one of these characters chooseCharacter=input("What character do you want to use?" and i need to put the users charOne and charTwo into the question. or some way need to make the user choose the user they want to use. Commented May 7, 2015 at 16:10
  • sorry, @SuperBiasedMan thats my code, since i have to write 15 chars, hi :) Commented May 7, 2015 at 16:25
  • @MichaelWade Ok, then take a look at what Peter Wood linked above. There are two main ways to insert a variable into a string, that link shows them both and has discussion on them. Commented May 7, 2015 at 16:30

1 Answer 1

4

Use Python string formatting:

charOne = input("Please input your first character's name: ")
charTwo = input("Please input your second character's name: ")

chooseCharacter = input("What character do you want to use? (%s or %s): " % (charOne, charTwo))
Sign up to request clarification or add additional context in comments.

1 Comment

Thank you so much! i was just messing with %s and didnt know how to use it! thank you very much! :D

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.