Python Basics

by DIYSTARLING in Circuits > Software

478 Views, 2 Favorites, 0 Comments

Python Basics

Fron.png

This instructable shows you how to do the basics of python.

Supplies

Python IDLE

Open Python

Unless you want your code to be carried out line by line and not saved, when you open python you need to open the shell and then click File > New File. This will open a blank python document which you can edit and create big programs in.

Comments

Comments.png

Comments are written in hashtags (#) and are not part of the code. The code will just skip past these.

Print Statements

Print Statements.png

Printing something makes it appear on the screen when the code is running. You print writing by typing print("write anything here") alternatively, you could print a variable by typing print(variable name here).

Examples of This Code in a Game

Code and comments.png
Code.png

This code is from my Mastermind game. Here is the link on how to code it.

https://www.instructables.com/Python-Mastermind-Game/