About the Python Help category

General help/discussion forum for the Python programming language. All welcome.

Please format your pasted code using Markdown backticks like this:

```python
# YOUR CODE GOES HERE
if me.is_hungry:
   me.bake("bagel")
```

This will look like this:

# YOUR CODE GOES HERE
if me.is_hungry:
   me.bake("bagel")

That’s nicely colored and keeps indentation intact! :sunglasses:

If you make a mistake, don’t worry: you can always edit your post later to fix it.

28 Likes
"How to ask questions" pin for "Users" category
Explaining users how to format their code examples
TypeError writing to csv
Snakes and ladders
Data is not correct in output when change to 2021 in pandas dataframe
Information for new users
How to solve this command STK in python
Backround timer
Float sayings it a string & cant do math with it
I'm learning Python from scratch.,
Python / Guido's Gorgeous Lasagna on Exercism
Need help with with probably a wrong code or smthg
While condition program having confusion
Making square within limit
Проблема с запуском парсера
Excel formula in python code
Correct mycode to delete some lines in a text file
Program is ignoring the last elif
Problem of prime number counter
Information for new users
Python | 'MSS' object has no attribute 'grab'
Basic help with code
Variable problems
Function Is Not Working As Expected Depending On Location <solved>
Need Code issue help
Len function retur always 0
Can u help me with this code?
Zero experience python user needs help
Splitting sections in an imported text file
Dataframes and Dictionary 'Lookups'
Summarization AI using nltk
Creating iterate over an enumerated list
Correcting my code
Problems with a code sample from a book
I Need To Be Pointed in the Right Direction
Python tkinter button disappear
Interrupt Question
Cant find python through command prompt
Convert DOB to age
Speech recognition package and other packages not importing on pycharm
Variable not working as desired
Human Interactive Chatbot
Hello, i need help with the code. I need read code of JSON, but I have a problem
How to bypass a "version" error?
Error running CMOD5.N with python
The 1st block gets an indentation but not the 2nd?
Django in community edition
Formatting a python source file in a new post
Trying to compute sum of list variables over a certain number
Need help in a python script for telegram mention bot
Unittest no being found
Getting error whenever I use pip command
Facing a problem while installing tkinter-idle in chromebook
I can't get this python script to run. Help!
Help with if statement and number comparison
Len function retur always 0
Using tuples in a function
New programmer needs help putting a list through a function or for loop
yappi does not import
Compare two variables
Помогите пожалуйста (Please help)
Getting passed env: python No such file or directory
From pynliner import fromString as inlinecss
Difference between running python codes in visual studio
Expected expression and “(“ was not closed error in Python script
Help! I have downloaded tensorflow but I can't import it
How to insert Dashed Lines in between Rows of a tabulate output
How can I loop this to create the skeleton of an auto-battler/Idle game
If statements and while loops
Python Socket library TCP client to Node-Red TCP Server Node not working
Python_Newbie: Take textfield entry, search in excel file for information and show them in another field
Help understand code, beginner
Read visitor data from a csv file
Hard copy printing
How to Auto-Scroll to Top
Python beginner - red/black roulette program question
About module of telebot
How to use if else statement in diamond star printing
Python not finding pip
Face recognition Jarvis project error
AttributeError: module 'functools' has no attribute 'cached_property'
Build python 3.12.1 with openssl
Numpy is not working
Unusual Error with print command
Having error while store data to mysql database
Python and GUI and dropdowns
Impossible to install Tkdesigner
Subplot Error Pls help
Problem with the numpy module
Download stock datas
Downloaded python but still having trouble
ErrorMessage says: class myitr, " myitr " is NOT defined
I am quite sure my program is correct, however, the 2nd part of correct answer doesn't show up
OSError occurs in Linux
Please HELP! Issue downloading as Python file from Jupyter Notebook - the py script is blank?
I am unable to see the figure. kindly help me out
EMPATH PACKAGE - inclusion of seed terms
My first coding assignment in Python
Errors installing python 3.10.11 in terminal
Unable to install pygrib
Getting an error in pip lock file Please help!
Can't run pyautogui comands in Python programs
I cannot find the pinned help topic about posting code
I have been trying to run this code but this is the output
Insert function not working for multiple entry boxes created in tkinter python3 when trying to insert values on click of a button
Can't get ReplicatorG 0400 to create GCodes with Python
Python help with opening file
MSVCRT Error:Could not find a version that satisfies the requirement msvcrt(from versions: none)
Newton method assignment
I need a help in regarding python telegram bot
Sum of Even Numbers help!
Pic not downloaded
Please help me to debug this error
Problem with my Insert (Sqllite)
I need help to make this code work
Can someone explain to me why this code doesn't work?
Getting error while running the command python install.py
Time series forecasting for sales data
CoinMarketCap API Price Notifier - Error
Data formatting and plot AR model
Getting error while running pyspark
PYTHONSTARTUP definition
PYTHONSTARTUP definition
Channel Already In Use
Installation of Jupyter Notebook
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x8b in position 1: invalid start byte
Help me with looping
TypeError: list indices must be integers or slices, not float im getting this error.. The question is to find the median of the 2D array
List index out of range Error for Append method in YoloV5
Why "No tests were found"
Please need urgent help!
Problem work exe after convert from py
Scraping ICD codes from WHO dynamic website
How to separate code
Blackduck reporting lzma.pyd as a xz utils component
Charmap' codec can't encode characters in position 0-3: character maps to <undefined>
Facial recognition
Panda dataframe update existing table with to_sql
New user - quite confused!
Win Error 32 : The system cannot find the file specified
Classes and Objects, Modules and Importing
K2601B_Pulse and K2602B link for Pulse LIV measurement (send me the request if you need the attached file)
Charmap' codec can't encode characters in position 0-3: character maps to <undefined>
Pycharm debugging not working
Optimization problem
Before the code worked, now it doesn't. Any help?
Various issues with python on Ubuntu WSL
Why doesn't this code work?
ModuleNotFoundError: No module named 'mylib'
Biotite in VScode gives FileNotFoundError! [WinError 2] The system cannot find the file specified
Python code giving error regarding python-can library
I have the latest python-can library installed on my laptop version 4.4.0 I am getting error that detect_available_configs can not be imported from can?
Smoothing Data, Box-car method
Syntax error I can't understand
KMeans with alternative distance formula (Coding issue)
A solution for circular import
Error with RINT
Syntax error I can't understand
Syntax error I can't understand
Help troubleshooting a program that suddenly exits when it has worked fine for years
Help troubleshooting a program that suddenly exits when it has worked fine for years
I need help with this bit of code
Help to add trail count
Whats wrong in this code?
How to change numpy arrays in a function and return the values?
Heart turtle for python code very useful and entertaining
Desperately need help
Running total calculations
An error occurred "No module named 'serial'
My issue of learning how to useing "open()"function
Pip install pyserial not working
No more >>> prompt in IDLE 3.12.x.x?
Pls help with error
Idea: Send new person a link to formatting messages
Running total calculations
Maze creation in Python
How can I publish my own code works?
Tensorflow and Distutils error
Pico 2 Button control 2 Relay
Persistent SyntaxError ("name used prior to global declaration") on macOS M4 with Python 3.9/3.10, even in minimal scripts and new virtual environments, not resolved by typical troubleshooting
Why math.gcd compute faster than %?
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xfd in position 0: invalid start byte
MergeSort issue
It says invalid syntax when trying to print
InsertionSort Problems
Hello --- I'm already confused
Elements missing when printing a range with self-defined end character
Python yfinance library data for Microsoft (MSFT) stock data differs from Yahoo Finance online, e.g. Open price on 4/28/25
GCD common factor
How to get ball to stay on screen
Issue with simple code
Nested While Loops
Problème de verssion speech_recognition
Help!database and phyton
Optimization problem
Label in matplotlib doesnot work
Dynamic functionname for import_module object
How to get extern data for my system exception subroutine?
Syntax error on else
Hi, I am new to python forum, but not Python, from New Zealand
I have an error "name 'cust_id' is not defined"
If else command giving different answer
Help with Lab (Writing a IF statement inside of a FOR loop)
Need help in fixing a code to run a simple app
Debug Module in Python 3.x
Continued invalid syntax for print function. Please help
Cant get this to work
How to make an addition operetion using f-strings?

3 posts were split to a new topic: IDLE not showing File menu

Evidently the code formatting used to be nicely colored from using ***py3. I get nice coloring from using…

```python

as the first fencing line as Carol Willing recommended in this helpful post.

Example:

    # YOUR CODE GOES HERE
    if me.is_hungry:
       me.bake("bagel")

UPDATE: I no longer have to use ```python to get full color for code (well, not full IDE color, but it’s still pretty good). HOWEVER, If I paste another code block right below the first one, one of them will use block quoting until I append the ````python.

6 Likes

[UPDATED]
A full treatment of the Commonmark markdown used by Discourse (and other platforms, like WhatsApp) CAN BE FOUND HERE.

AND ALSO HERE

Thankfully, this forum uses DiscoURSE not DiscoRD. Discourse is
free/libre open source software. Discord is a proprietary service
designed to profit by selling your personal data and conversations
(but don’t just take my word for it, read their privacy policy if
you’re interested).

For the Markdown-it engine used by Discourse, their documentation
recommends you just refer to the CommonMark Specification:

https://commonmark.org/help/
https://spec.commonmark.org/current/
4 Likes

Thank you for pointing that out. I was surprised when it looked like we were using it here on an installation at the python.org web server. Am relieved that we aren’t.

I’ve updated my post.