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.

CL

Related Python Mentoring answers

All answers ▸

Print "Hello World!" ten times without typing (or pasting) the print function more than once


Whats is the difference between a function and a procedure?


Write a program that takes a value x and then outputs x Fibonnaci numbers. E.g. if x=6 output would be 1 1 2 3 5 8


[Exam style] Python is an interpreted language. Explain what this means and how interpreted languages differ from compiled languages.