Topic 1 Flashcards
(41 cards)
Python counts from
0
CPU stands for… and is composed off …
It’s composed of 2 types of storage: …
Central processing unit
Control unit and arithmetic logic unit (ALU)
primary and secondary unit
3 coding components
Sequence of instructions
Control of flow
A way to stop
Algorithm
Step by step instructions on how to complete a task
Program
A set of instructions represented in the form of a programming language
int represents … and common uses are …
whole numbers (-2, 0, 2)
counting purposes
float represents … and common uses are …
real numbers (3.14)
numeric calculations
str represents … and common uses are …
sequence of characters (“hello”)
keys, input/output
bool represents … and common uses are …
true or false
control flow in programs
NoneType represents … and common uses are …
(None)
return type of a function that appears to not return anything
**
power
*
multiplication
/
division
+
addition
-
subtraction
%
modulus
Can ints and floats be mixed in arithmetics?
Yes, python will automatically convert int to float if needed
== vs =
== is an equality operator, compares 2 values, returns true if values are equal
= is an assignment operator, used to assign a value to a variable not compare
!=
not equal to
< / >
smaller / larger than
<= / >=
smaller than / larger than or equal to
== / != / < / > / <= / >= return … values
boolean (true / false)
boolean operators
and (returns true if all values are true), or (returns true if at least 1 value is true)
Any … of some type is evaluated to true when we use bool ()
print (bool (“Text”)) –>
print (bool (“”)) –>
print (bool (102)) –>
print (bool (0)) –>
non-empty or non-zero value
True
False
True
False