Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 How to format characters that are given by user input with user input
#1
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.
Larz60+ wrote Feb-28-2019, 02:51 AM:
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.

I added for you this time, please use BBcode tags on all future posts
Quote
#2
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.
buran likes this post
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures

Quote

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  User input & Dictionary tfernandes 4 70 2 hours ago
Last Post: ndc85430
  Problem with user defined main menu function stefzeer 3 96 Mar-27-2020, 06:12 AM
Last Post: buran
  User Input and CSV File Davy_Jones_XIV 2 129 Mar-24-2020, 08:43 AM
Last Post: Davy_Jones_XIV
  how to manage an input() rodrigoH 1 100 Mar-16-2020, 12:24 AM
Last Post: jefsummers
  user input producing incorrect boolean al_Czervik 4 171 Mar-05-2020, 09:50 PM
Last Post: al_Czervik
  input-ValueError: invalid literal for int() jacklee26 2 290 Feb-21-2020, 01:27 PM
Last Post: ndc85430
  Input() function not working in VS Code darpInd 7 270 Feb-17-2020, 03:28 PM
Last Post: snippsat
  Using input function in a Class wew044 2 170 Feb-06-2020, 03:08 AM
Last Post: wew044
  How to make input goto a different line mxl671 2 296 Feb-04-2020, 07:12 PM
Last Post: Marbelous
  User defined functions inside other user defined functions WildP 1 145 Jan-29-2020, 04:57 PM
Last Post: Clunk_Head

Forum Jump:


Users browsing this thread: 1 Guest(s)