This study guide was created by one of your peers for Foundations of
Programming (FOP). It covers all six domains of the course. The
information was gathered from GMetrix instructional videos and
supplemental resources such as GeeksforGeeks and other programming
references.
Core concepts are displayed openly in each section. Additional
details and practice questions are available in expandable sections
that can be opened by clicking the “Details” or “Practice Questions”
buttons at the bottom of each topic.
Code examples are included throughout the guide. You are encouraged
to copy and run the code to test your understanding as you work
through the material.
Layout Structure
Study Guide → Domain → Subsections within
each domain
Each domain contains structured explanations, examples, and review
questions to help reinforce understanding.
I am currently still working on this it not yet complete
Domain 1 Operations using data
Domain 1 covers variables and naming rules, data types (including
lists), type casting functions, arithmetic operators, comparison
operators, logical keywords, identity operators, membership
operators
Variables
Variables are container of data, like text numbers true or false
values, and even other Variables.
Rules for Naming Variables
To use variables effectively, we must follow Python’s naming rules:
Variable names can only contain letters, digits and underscores
(_).
A variable name cannot start with a digit.
Variable names are case-sensitive like myVar and myvar are
different.
Avoid using
Python keywords
like if, else, for as variable names.
"this is from GeeksforGeeks"
best practices when making variables is to use camel casing; the
first letter of the first word is lowercase and any subsequent words
start with a capital letter. (from the videos)
according to the video (second video named Evaluate Data Types: Time
-0.02 ) Python is a loosely typed language, meaning variables do not
need to be declared before they are used.
this information is wrong python is not a loosely typed language it
is a strong typed language, and you can't use a variable before it
declared.
A strong typed language means; a programming language that enforces
strict rules regarding the use of variable types, preventing the
mixing of different types in operations and assignments.
Variables can be String, Int, Float, Bool, list.
Strings: a string is a variable that allows you to hold
text, text is numbers letters emojis symbols. you can use any
symbol in the UTF-8 encoding of Unicode.
Int: a int is variable that allows you to hold whole
numbers Ex 1 2 3.
Float: a float is a variable that allows you to hold real
numbers Ex 1.25 2.568 3.1231 but there is a limit to the point
precision (how accurate it is after the . ) Explanation at
GeeksforGeeks
Bool: a bool also know as a boolean is a True or false
variable meaning it can only hold true or false, in python you
have to uppercase the first letter of the true or false word if
not it a syntax Error. List a list is a collection of other
variables the list can be mixed of different data types.
s = "this is a string" # a string can also be made with single quotes in python
i = 123 # this is a int
f = 1.0 # this is a float
b = True # this is a bool
l = [s,i,f,b] # this is a list
for item in l:
print(item)