How do I use format python code?

You should beware of indentation in your code as indentation will affect how the code runs and can prevent you from being able to compile your code. It can also create logic errors, producing results which you didn't expect to receive. Make sure you code things in the right order, for example initialise variables before you use them. Also make sure to import modules which you may need to use at the start of your program. Apart from that, there is no special format needed to start off code unlike in other languages such as C or Java.

Answered by Charlene L. Python tutor

1494 Views

See similar Python Mentoring tutors

Related Python Mentoring answers

All answers ▸

Create an rock, paper, scissors game. The user should input one option, and the computer should play randomly.


Write a function that checks whether a number is prime or not.


Write a function that takes an imput (call it usr_in), the user's age (usr_age) and the user's name (usr_nm) and outputs the following string: "Hi, My name is [usr_nm], I am [usr_age] years old, and my favorite number is [usr_in]"


When to use a dectionary or a list


We're here to help

contact us iconContact usWhatsapp logoMessage us on Whatsapptelephone icon+44 (0) 203 773 6020
Facebook logoInstagram logoLinkedIn logo
Cookie Preferences