<jupyter_start><jupyter_text>Welcome to Python FundamentalsIn this module, we are going to establish or review our skills in Python programming. In this notebook we are going to cover:* Variables and Data Types * Operations* Input and Output Operations* Logic Control* Iterables* Functions  Variable and Data Types  Variables and data types in Python are, as the name implies, values that change. A variable is a memory region in a computer language to store a value. The value you've saved may change in the future if the specs change.<jupyter_code>x = 1
a,b = 0, -1
type(x)
y = 1.0
type(y)
x = float(x)
type(x)
s, t, u = "0", "1", 'one'
type(s)
s_int = int(s)
s_int<jupyter_output><empty_output><jupyter_text>Operations  Operators are Python's particular characters for solving math or logic computation. The operand is the value that the operator performs on—for instance, 2+10=12. Here the + sign is the operator that carries out the given equation. Additionally, 2 and 10 are known as the operands, and 12 is the operation's output.  Arithmetic  In Python, the arithmetic operators execute mathematical operations, including addition, subtraction, multiplication, and division.  The addition operator in Python is +. It's used to combine two numbers.	The subtraction operator in Python is -. It takes the second number and subtracts it from the first.	The multiplication operator in Python is *. It's used to calculate the product of two numbers.	The division operator in Python is /. When the first operand is divided by the second, it is utilized to get the quotient.	The exponentiation operator in Python is **. It elevates the first operand to the second operand's power.	The modulus operator in Python is %. When the first operand is divided by the second, it gets the remaining.<jupyter_code>a,b,c,d = 2.0, -0.5, 0, -32
### Addition
S = a+b
S
### Subtraction
D = b-d
D
### Multiplication
P = a*d
P
### Divison
Q = c/a
Q
### Floor Division
Fq = a//b
Fq
### Exponentiation
E = a**b
E
### Modulo
mod = d%a
mod<jupyter_output><empty_output><jupyter_text>Assignment Operations  Assignment Operators functions to assign values to variables. The following are some examples of assignment operators that this activity utilized:  1. =, this functions to assign the value of ride of expression to the operand on the left side 2. +=, this will add the operand on the right side alongside the operand on the left side operand 3. -=, this assignment operator subtracts the right operand from the left operand then assign it to the left operand 4. *=, it multiplies right operand with left operand then assign to left operand 5. **=, this will calculate the exponent value using operands and assign value to left operand<jupyter_code>G, H, J, K = 0, 100, 2, 2
G += a
a
H -= d
H
J *= 2
J
K **= 2
K<jupyter_output><empty_output><jupyter_text>Comparators  Comparators are used to compare two values. It performs comparisons and generates boolean values. Although it is often used with numerical values, other data types may also be utilized.  == symbol represents the equal to operator. It compares the values on the left and right sides. It returns True if the left-side value equals the right-side value. Otherwise, False is returned. != symbol represents the not equal to operator. It compares the values on the left and right sides. It returns True if the left-side value is not equal to the right-side value. Otherwise, False is returned. == symbol represents the equal to operator. It compares the values on the left and right sides.It returns True if the left-side value equals the right-side value. Otherwise, False is returned. != symbol represents the not equal to operator. It compares the values on the left and right sides. It returns True if the left-side value is not equal to the right-side value. Otherwise, False is returned. < symbol represents the less-than operator. It compares the values on the left and right sides. It returns True if the left-side value is less. Otherwise, False is returned. <= symbol represents the operator less than or equal to. It compares the values on the left and right sides. It returns True if the left-side value is less than or equal to the right-side value. Otherwise, False is returned.<jupyter_code>res_1, res_2, res_3 = 1, 2.0, "1"
true_val = 1.0
## Equality
res_1 == true_val
## Non-equality
res_3 != true_val
## Inequality
t1 = res_1 > res_2
t2 = res_1 < res_2/2
t3 = res_1 >= res_2/2
t4 = res_1 <= res_2
t3<jupyter_output><empty_output><jupyter_text>Logical  A logical operator is a character or term that joins various expressions. The value of the originalstatements entirely influences the validity of the compound expression generated and the operator's significance. This activity used logical operators such as AND, OR, and NOT<jupyter_code>res_1 == true_val
res_1 is true_val
res_1 is not true_val
p,q = True, False
conj = p and q
conj
p,q = True, False
disj = p or q
disj
p,q = True, False
e = not(p and q)
e
p,q = True, False
xor = (not p and q) or (p and not q)
xor<jupyter_output><empty_output><jupyter_text>I/O  Input and output are concepts that refer to the way a computer software communicates with its user. The user provides input to the program, while the software provides output to the user.  The print() method sends a message to the screen or another standard output device. A counter tool “cnt” is included to help with quick and easy tallying. In Python, single quotes, double quotes, and even triple quotes may generate strings. Unicode characters are represented as strings, which are arrays of bytes. You need to give the names of the variables within a set of curly brackets when using f-Strings to show variables. All variable names will be replaced with their relevant values during runtime.<jupyter_code>print("Hello World")
cnt = 1
string = "Hello World"
print(string, ", Current run count is: ", cnt)
cnt += 1
print(f"{string}, Current count is: {cnt}")
sem_grade = 82.243564657461234
name = "qtpie"
print("Hello {}, your semestral grade is: {}". format(name, sem_grade))
sem_grade = 82.243564657461234
name = ""
print("Hello {}, your semestral grade is: {}". format(name, sem_grade))
w_pg, w_mg, w_fg = 0.3, 0.3, 0.4
print("The weights of your semestral grade are: \
\n\t{: .2%} for Prelims\
\n\t{: .2%} for Midterms, and\
\n\t{: .2%} for Finals.".format(w_pg, w_mg, w_fg))
x = input("enter a number: ")
x
name= input("Kimi ni nawa: ")
pg = input("Enter prelim grade: ")
mg = input("Entermidterm grade ")
fg = input("Entermidterm grade ")
sem_grade = None
print("Hello {}, your semestral grade is: {}" .format(name, sem_grade))<jupyter_output>Kimi ni nawa: krissy
Enter prelim grade: 89
Entermidterm grade 90
Entermidterm grade 95
Hello krissy, your semestral grade is: None<jupyter_text>Looping Statement  It comprises a series of operations that are repeated numerous times until the desired result is reached. Python includes two looping statements: for and while, which are employed to identify them in this exercise.  While  Python While Loop is used to repeatedly execute a block of statements until a given condition is satisfied. And when the situation becomes false, the line immediately after the loop in the program is executed.<jupyter_code>## while loops
i, j = 0, 10
while(i<=j):
  print(f"{i}\t|\t{j}")
  i+=1<jupyter_output>0	|	10
1	|	10
2	|	10
3	|	10
4	|	10
5	|	10
6	|	10
7	|	10
8	|	10
9	|	10
10	|	10<jupyter_text>For  A "For" Loop is used to loop a code block a predetermined amount of times. In the "For" loop, the number of iterations to be performed is already known. It is employed to achieve the desired outcome. On the contrary, in a while loop, the command runs until a particular condition is satisfied and the statement is proven to be wrong.<jupyter_code># for(int i=0; i<10; i++){
# printf(i)
# }

i=0
for i in range(10):
  print(i)
playlist = ["Crazier", "Happier", "Bahay-Kubo"]
print('Now Playing:\n')
for song in playlist:
      print(song)<jupyter_output>Now Playing:

Crazier
Happier
Bahay-Kubo<jupyter_text>Flow Control  Flow control statements may be used to determine which Python instructions should be executed when such criteria are met.  The if-elif-else statement is used to conditionally execute a statement or a block of statements. Conditions can be true or false, execute one thing when the condition is true, something else when the condition is false.  Condition Statements  In a Python programming language, the if statement governs the program flow. The "elif" and "else" functions are seen in most if statements. This indicates that while there may be various "elif", there is only one "else". The if statement must end with the "else"; thus, no other "elif" branches can be added.<jupyter_code>numeral1, numeral2 = 13, 14
if(numeral1 == numeral2) :
  print("Yey")
elif(numeral1>numeral2):
  print("Hoho")
else:
  print("Awww")<jupyter_output>Awww<jupyter_text>Functions<jupyter_code># void DeleteUser(int usedid){
# delete(userid);
# }

def delete_user (userid):
  print("Successfully deleted user: {}". format(userid))

def delete_all_users ():
  print("All of us are dead")
userid = "Krissy"
delete_user("Krissy")
delete_all_users()
def add(addend1,addend2):
  return addend1 + addend2

def power_of_base2(exponent):
  return 2**exponent
addend1, addend2 = 24, 25
add(addend1, addend2)

exponent = 8
power_of_base2(exponent)<jupyter_output><empty_output><jupyter_text>Assignment<jupyter_code>w_pg, w_mg, w_fg = 0.30, 0.30, 0.40
name = input("Enter your name: ")
course = input("Enter your course: ")
yearlevel = input("Enter your year level: ")
pg = float(input("Enter Prelim Grade: "))
mg = float(input("Enter Midterm Grade: "))
fg = float(input("Enter Finals Grade: "))
sem_grade = (pg*w_pg) + (mg*w_mg) + (fg*w_fg)
print("Your Sem Grade is: {: .2f} ".format (sem_grade))
if(sem_grade > 70): print("\U0001F600")
elif(sem_grade == 70): print("\U0001F606")
else: print("\U0001F62D")<jupyter_output>Enter your name: <NAME>
Enter your course: Chemical Engineer
Enter your year level: 2nd Year
Enter Prelim Grade: 90
Enter Midterm Grade: 93
Enter Finals Grade: 96
Your Sem Grade is:  93.30 
😀
{'fraction_non_alphanumeric': 0.08556202506661403, 'fraction_numerical': 0.022895489983223133, 'mean_word_length': 4.693258426966292, 'pattern_counts': {'":': 0, '<': 47, '<?xml version=': 0, '>': 45, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '11', 'dir': 'jupyter-structured-clean-dedup', 'id': '496687', 'license': 'Apache-2.0', 'n_tokens_mistral': 3207, 'n_tokens_neox': 3036, 'n_words': 1430, 'path': 'Activity_1_Python_Fundamentals.ipynb', 'repo_name': 'krissydolor/Linear-Algebra-_-2nd-Sem', 'size': '10139'}