Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

How do I put code snippets in my answers or questions or comments?

+3 votes
asked Jan 13, 2021 by KKN (1,110 points)

For example

Let's say I have an answer to a question like:

HOW DO I  APPEND 2 FILES IN PYTHON 3 ONLINEGDB?? HELP NOW!!!

And I say

f = open("file.txt", "a") # Make sure to put the directory 

f.write("Your text here")

f.close() # Close the file if you want

But I want to make it look professional, how do I do it?

Thanks in advance

~ KKN :)

1 Answer

+1 vote
answered Jan 14, 2021 by Peter Minarik (84,720 points)
selected Jan 14, 2021 by KKN
 
Best answer

When you have inserted your code, select it and change the Paragraph Format from Normal to Formatted.

[Font v] [Size v] [Normal v]

Please note, comments cannot have formatting (only questions and answers).

Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...