Python Language Reference Flashcards
print()
Print “ “ takes whatever inputs or str you put in it then prints it out in your program.
ex. print “Hello world.”
print()
Print “ “ takes whatever inputs or str you put in it then prints it out in your program.
ex. print “Hello world.”
python (program).py
This is how you run a python program from command prompt or powershell. First you type in python, then the name of the program ( which you need to be in the right directory) then .py and this runs the program.
#
Hash tag (octothorpe) this comments string to explain a section of code, also useful for disabling lines of code when necessary.
Operators
used for math in code mainly but have other uses also (+ - * / % < > <= >=)
+
Plus / addition
-
minus / subtraction
/
forward slash / division
*
asterisk / multiplication
%
percent / modulus
>
greater than
<=
less than equal
> =
greater than equal
Variables
variables are nothing but reserved memory allocations to store values
floating point
are numbers represetnted in computer hardward as base 2 binary functions
ex. 1.0
=
assigns a value on the right to a value on the left
==
test’s if two things has the same value
Format string
python uses c style string formatting. % operator is used to format a set of variables enclosed in a “tuple” (fixed sized list) string can be prints, saved to files, sent to servers, etc.