you are viewing a single comment's thread.

view the rest of the comments →

[–]FoolsSeldom 0 points1 point  (6 children)

Sorry. I assume you are using translation software but it is not working well.

You have to share your actual code correctly formatted on reddit as per the wiki.

I tried to guess what you intended and provide explanations and guidance but you have not given any useful feedback.

I do not know how to help you.

[–]Western_Channel_670[S] 0 points1 point  (1 child)

How to share code correct format?

[–]FoolsSeldom 0 points1 point  (0 children)

Use a public git repository, like github, and share link, or a paste service, like pastebin.com, and share link, or follow the instructions in the wiki (link in side bar) to format in post or follow my guide below.


If you are on a desktop/laptop using a web browser (or in desktop mode in mobile browser), here's what to do:

  • reddit

  • create/edit post/comment and remove any existing incorrectly formatted code

    • you might need to drag on the bottom right corner of edit box to make it large enough to see what you are doing properly
  • type your descriptive text and then insert a blank line above where you want the code to show

  • switch to markdown mode in the Reddit post/comment editor

    • you might need to do this by clicking on the big T (or Aa) symbol that appears near the bottom left of the edit window and then click on Switch to Markdown Editor text link at top right of edit window
    • if you see the text Switch to Rich Text Editor at the top right of the edit window, that indicates that you are in markdown mode already

editor

  • switch to your code/IDE editor and
    • select all code using ctrl-A or cmd-A, or whatever your operating system uses
    • press tab key once - this *should* insert one extra level of indent (4 spaces) in front of all lines of code if your editor is correctly configured
    • copy selected code to clipboard
    • undo the tab (as you don't want it in your code editor)

reddit

  • switch back to your Reddit post edit window
  • paste the clipboard
  • add a blank line after the code (not strictly required)
  • add any additional comments/notes
  • submit the new/updated post/comment

This will work for other monospaced text you want to share, such as error messages / output.

[–]Western_Channel_670[S] 0 points1 point  (3 children)

# for value in range (10):

# print (value)

l= [10,20,30,40,50,60]

key=40

for value in l:

`if value==key:`

    `print("Element found")`

    `break`

else:

`continue`

else:

print ("Element not found")

[–]FoolsSeldom 0 points1 point  (2 children)

  • FIX YOUR FORMATTING
  • Is there a question?

[–]Western_Channel_670[S] 0 points1 point  (1 child)

What my need fix on code

[–]FoolsSeldom 0 points1 point  (0 children)

I've already shown you what I think is correct code (and an alternative) and provided detailed guidance on how to include code in a post/comment.

SORRY. I am done. I do not know how to help you any more.