<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 are alphabet letters from a-z, words, or underscore where a programmer canstore or declare a certain value or a data type to be used for specifications. Every variable isaffiliated with data types. Data types define what is the meaning of data, what must be done,and in what way must the declared values be stored [2]. In simpler words, data typedetermined what type of operation must be performed in the stored data.Number, string, lists, tuple, set, dictionary and tuple are the different data types thatcan be used in python programming [3]. Each data type has a specific purpose in thedeclaration of data.<jupyter_code>x = 1
a,b = 0, -1
x
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 In the python programming language, there are special symbols called “operators”that implement mathematical and logical computation. Operand stands for the mediumoperated on by the operator. The python operators are Arithmetic Operators, ComparisonOperators, Logical Operators, Bitwise Operators, Assignment Operators, and SpecialOperators   Arithmetic From the word itself, arithmetic operations are used to execute mathematicaloperations such as multiplication, addition, subtraction, and division. Itwas made possible by the use of the operation signs, “+, -, /, *”. Floor division using thecode, “//”, exponentiation using the code, “**”, and modulo using the code, “%”, are also partof arithmetic operations<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
### Division
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 It enables theprogrammer to assign values in the variables.<jupyter_code>G, H, J, K = 0, 100, 2, 2
G += a
G
H -= d
H
J *= 2
J
K **= 2
K<jupyter_output><empty_output><jupyter_text>Comparators Comparison operators are used in comparing values as it checks the equality,non-equality, or inequality of two different variables;conforming to the condition, it returns either true or false.<jupyter_code>res_1, res_2, res_3 = 1, 2.0, "1"
true_val = 1.0
## Equality
res_1 == true_val
## Non-equality
res_2 != 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
t1<jupyter_output><empty_output><jupyter_text>Logical The application of math logic through programming. Ituses “and” to denote the logic of conjunction, “or” to denote disjunction, and “not” to denotenegation. Math logic has this so-called “Truth Table” and the codes presented are thearguments of that table.<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
nand = not(p and q)
nand
p, q = True, False
xor = (not p and q) or (p and not q)
xor<jupyter_output><empty_output><jupyter_text>I/O Input operations’ function, using the code “input()”, is for the programmer or theintended user to input any data that is required in the program. It evaluates the inputted dataand convert it later into a string or float depending on the data inputted by the user. Outputoperations are used to display the inputted data or any message using the code, “print()” byevaluating the data first.<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 = ""
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 no na wa: ")
pg = input("Enter prelim grade: ")
mg = input("Enter midterm grade: ")
fg = input("Enter finals grade: ")
sem_grade = None
print("Hello {}, your semestral grade is: {}".format(name, sem_grade))<jupyter_output>Kimi no na wa: Arnold
Enter prelim grade: 89
Enter midterm grade: 88
Enter finals grade: 78
Hello Arnold, your semestral grade is: None<jupyter_text>Looping Statements In general, statements are performed in the following order: the first statement in afunction is executed first, then the second, and so on [6]. There may be occasions when youneed to execute a block of code numerous times. A loop in python programming enables theuser to execute a statement or group of statements multiple times depending on the declaredcondition [6].  While In the Python programming language, a while loop statement runs a target statementrepeatedly as long as a specific condition is true. Statements can be either a single statementor a group of statements. Any phrase can be used as the condition, and any non-zero value isconsidered true. While the condition is true, the loop iterates [6]. When the condition is met,program control is transferred to the line immediately after the loop.<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 forloop statement is a control flow statement that is used to execute a series of instructionsrepeatedly as long as the condition is met. An iterative statement is another name for this sortof statement [6]. The code, “range()”, is used to set the limitation of the loop<jupyter_code># for(int i=0; i<10; i++){
# printf(i)
# }

i = 0
for i in range(10):
  print(i)
playlist = ["We don't talk about Bruno"]
print('Now Playing: \n')
for song in playlist:
  print(song)<jupyter_output>Now Playing: 

We don't talk about Bruno<jupyter_text>Flow Control The control flow of a program is the sequence in which the program's code runs.Conditional statements, loops, and function calls govern the control flow of a Pythonprogram [7].  Conditional Statements The if statement in Python programming provides for conditional execution of astatement or collection of statements depending on the value of an expression [8]. Elif is anabbreviation for else if. It enables the programmer to check for many expressions at the sametime. If the condition for 'if' is false, the condition of the following 'elif' block is checked, andso on. If all of the criteria are false, the else body is performed [9].<jupyter_code>numeral1, numeral2, = 12, 13
if(numeral1 == numeral2):
  print("Yey")
elif(numeral1 > numeral2):
  print("Hoho")
else:
  print("Aww")<jupyter_output>Aww<jupyter_text>Functions Functions in python programming aid in the division of our software into smaller,modular portions. As our software develops in size, functions help to keep it structured andmanageable. It also reduces repetition and makes the code reusable [10].<jupyter_code># void DeleteUser(int userid){
#     delete(userid);    
# }

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

def delete_all_users ():
  print("Successfully deleted all users")
userid = "Eugene"
delete_user("Eugene")
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>Activity 1 Semestral Grade Calculator The “Semestral Grade Calculator” is the application of all thelessons that the instructor discussed regarding the fundamentals of python programming.<jupyter_code>print("Good day! Please input the necessary information below.")

print()

name = input("Full Name: ")
course = input("Course: ")

print()

p = float(input("\tEnter Prelim Grade: "))
m = float(input("\tEnter Midterm Grade: "))
f = float(input("\tEnter Final Grade: "))

sem_grade = (p*0.30 + m*0.30 + f*0.40) 

if (float(sem_grade) == 70.00):
  print("\nHello, {} of {}! Your Semestral Grade is {:.2f}% \U0001F606 That was close!".format(name, course, sem_grade))
elif (float(sem_grade) > 70.00):
  print("\nHello, {} of {}! Your Semestral Grade is {:.2f}% \U0001F600 Keep it up and good work!".format(name, course, sem_grade))
else :
  print("\nHello, {} of {}! Your Semestral Grade is {:.2f}% \U0001F62d Study more and try harder!".format(name, course, sem_grade))<jupyter_output>Good day! Please input the necessary information below.

Full Name: <NAME>
Course: Chemical Engineering

	Enter Prelim Grade: 70
	Enter Midterm Grade: 70
	Enter Final Grade: 70

Hello, <NAME> of Chemical Engineering! Your Semestral Grade is 70.00% 😆 That was close!
{'fraction_non_alphanumeric': 0.09610074008615928, 'fraction_numerical': 0.023969954711145477, 'mean_word_length': 4.940944881889764, 'pattern_counts': {'":': 0, '<': 46, '<?xml version=': 0, '>': 46, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '443378', 'license': 'Apache-2.0', 'n_tokens_mistral': 2978, 'n_tokens_neox': 2802, 'n_words': 1210, 'path': 'Activity_1_Python_Fundamentals.ipynb', 'repo_name': 'Rnld123/Linear-Algebra_2nd-Sem', 'size': '9079'}