PYTHON DEFINITIONS Flashcards
Primitives
o Numbers
o Strings
o Booleans
Numbers
values that allow us to do calculations and keep count.
Strings
Are any sequence of characters (letters, spaces, numbers, or symbols). used to represent text or speech.
“Hello World”
Boolean
represent one of two values, true and false.
Operators
Are different symbols that represent an operation, such as the plus sign (+) as a symbol for addition.
Operations enable us to process our data, to transform it into something else.
Operating in Program include
*Making calculations using arithmetic operators.
*Comparing information using comparison operators.
*Creating logical expressions using logical (aka Boolean) operators.
Arithmetic Operators
Performs Calculations
+, -, *, /
Comparison Operators
Comparing values and evaluate their relationship
Less than < — value to the left is less than the value to the right: 2 < 6
Greater than > — value to the left is more than the value to the right: 14 > 5
Equals == — value
Tuple
is an ordered sequence of objects or characters separated by commas with parentheses on either side of the sequence.
mytuple= (7,”u”,”p”,1,”e”)
Strings & Tuple
Both immutable / you can’t update the data once you create it.
Variable
Stores your data information
mycoffee:
Dictionaries
Stores data as a collections of key-value pairs.
menu= {“avocado toast”: 6, “carrot juice”:5, “blueberry muffin”]
menu = dictionary
avocado toast , 6 = key-value pair (comparing both vaules)
Interger
Whole number without decimals
Control Flow
Control flow is the order in which instructions are executed.
List
Used to store multiple items in a single variable.
[2,4,6,8,10,12]