Python Forum

Full Version: me again...:)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
ok for once this is not for homework but to make my output look better

    elif option == 3:
        for item in FAQ:
            print("Question: ", item)
            print("Answer: ", FAQ[item])
this is part of my assignment which I think is pretty easy this week. When I print it out I want to have some space between each set of FAQ/answers
like this:

current output:
Question:
Answer:
I want :
Question:

Answer:
Also when I print the dictionary they will all be on top of each other so I want to space that aswell.

Thanks in advance. Again this is not part of the homework it comes out just like it should for school work purposes I just want it cleaner
Have you covered format yet? Having your string with braces, and a \n after the braces followed by the appropriate format statement should fix you right up.
(Aug-06-2019, 09:35 PM)jefsummers Wrote: [ -> ]Have you covered format yet? Having your string with braces, and a \n after the braces followed by the appropriate format statement should fix you right up.

Not fully, Im not sure what you mean so I think my desire for neatness will have to wait.....lol
I have other issue with the code im trying to fix so I will work on this later


Thanks
Well, if you haven't covered format by itself, note that print() by itself will print a blank line. Also \n in a string represents a new line, so print('\nQuestion:') will print a blank line before the word 'Question'.
(Aug-06-2019, 10:20 PM)ichabod801 Wrote: [ -> ]Well, if you haven't covered format by itself, note that print() by itself will print a blank line. Also \n in a string represents a new line, so print('\nQuestion:') will print a blank line before the word 'Question'.

yep that was easy thanks and it cleans it up