Python Forum

Full Version: How to format characters that are given by user input with user input
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I am writing a program (in Python 3.7.2) that is supposed to print out a flag with the width of the flag being user input and the characters used in the flag also being user input. I am having difficulty in formatting the characters according to user input. This is what I have so far:
Greeting = “Hi, I’m flaggy the flagmaker. Let’s make a flag!”
print (Greeting)
width = (int (input (“What’s the width of your flag?”)))
if width > 0:
     print (width)
elif width < 1:
     print (input( “What’s the width of your flag?\n>”))
characters = input (“What characters would you like to use?\n>”)
if characters == :
     print (input (“What characters would you like to use\n>?”))
print (format (characters3))
str = [’>width’]
print [str. format [“characters”]]
print [str. format [“characters”]]
print (format (characters3))
*my issues are in the third to last and second to last lines where I know the format is incorrect but I’m not sure how to correct it.
Check out the documentation format method of strings, and the full format method syntax here. Also, note that code with smart quotes won't run correctly. That means we can't run your code. That means it's harder for us to help you.