<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 In Computer Programming, variables are a symbolic reference to store information. In order for our programs to be understood by other people and ourselves, these variables allow us to identify data with descriptive names. Their main objective is not just to store data in memory but also to label. On the other hand, the one that classifies the type of data that a variable can hold, which tells the compiler how to interpret the data, is what you call data type. Various data types are string, character, integer, float, and boolean. This activity used different variables to store memory location, such as x, a, and b, and we tried to identify which data type is stored in a particular variable.<jupyter_code>t = 2
r,j = -1, 12
type(t)
j = 3.0
type(j)
r =float(r)
type(r)
w,t,f = "1", '2', 'cute'
type(f)
w_int = int(w)
w_int<jupyter_output><empty_output><jupyter_text>Operations In programming, performing mathematical operations are widely used. Operators are special character that informs the  compiler to operate or perform a specific mathematical operation. There is various type of operators that programmers use, which are the following: arithmetic, relational, and logical operators.  Arithmetic Arithmetic operators are used to performing the four fundamental operations of Mathematics which are the following: addition, subtraction, multiplication, and division, including the modulus,'%,' which finds the remainder of two given integers. In this activity, we set a value for a specific variable to perform the five operations and the exponentiation.<jupyter_code>q,w,e,r = 12.0, -1.5, 10, -22
### Addition
S = q + r
S
### Subtraction
D = e - r
D
### Multiplciation
P = w*q
P
### Division
Q = e/r
Q
### Floor Division
Fd = q//r
Fd
### Exponentiation
E = q**e
E
### Modulo
mod = r%q
mod<jupyter_output><empty_output><jupyter_text>Assignment Operations Assignment operators are used to assigning a value to a variable. The assignment operator's left operand is a variable, and its right is a value. The weight on the right side must be of the same data type as the variable on the left side, or else the compiler will throw an error. In this activity, we perform different assignment operators by combining the equal sign '=' with another operator, such as the symbol for addition, subtraction, multiplication, division, and exponentiation.<jupyter_code>R,J,B,F = 1, 10, 32, 39
R += w
R
J -= q
J
F *= 3
F
B **=3
B<jupyter_output><empty_output><jupyter_text>Comparators Comparators, also known as relational operators, compare the two given values and identify the relationship between the two entities. We let an actual value as a basis for this activity, and we perform various examples for equality, non-equality, and inequality. The result of this comparison is either true or false.<jupyter_code>res_1, res_2, res_3 = 0.7, 2.0, "1"
true_val = 1.50
## Equality
res_3 == 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/res_2
t4 = res_1 <= res_2
t3<jupyter_output><empty_output><jupyter_text>Logical A logical operator is a symbol or word used to join two or more expressions. The value of the resulting compound expression is determined only by the value of the original expressions and the operator's meaning. AND, OR, and NOT are the most common logical operators. For this part of the activity, we used the given conditions of the comparators to perform logical operators. We compare a particular condition to the actual value of 1.0 to determine whether the relationship is true or false. Also, we performed some logical math connectors like conjunction and disjunction, denoted by 'and' and 'or,' respectively.<jupyter_code>res_1 == true_val
res_1 is true_val
res_1 is not true_val
s, t = True, False
conj = t and s
conj
s, t = True, False
disj = s or t
disj
s, t = True, False
e = not(s and t)
e<jupyter_output><empty_output><jupyter_text>I/O - Input & Output  In programming, Input and Output is the communication that happens between the user and the computer program. The Input is where the user communicates by writing codes. Output on the other hand is the feedback of the computer from the program written by the user. It evaluates and shows the result of the program.<jupyter_code>print("Hellooo pooo")
cnt = 1
string = "Hellooo pooo"
print(string, ", Current run count is:", cnt)
cnt =+2
print(f"{string}, Current count is: {cnt}")
sem_grade=98
name = "RJ"
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 grades 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("Name: ")
pg = input("Enter prelims grade: ")
mg = input("Enter midterm grad: ")
fg = input("Enter finals grade: ")
sem_grade = None
print("Hello {}, your semestral grade is: {}".format(name, sem_grade))<jupyter_output>Name: RJ
Enter prelims grade: 96
Enter midterm grad: 96
Enter finals grade: 96
Hello RJ, your semestral grade is: None<jupyter_text>Looping Statements In programming, the loop statements repeatedly execute the series until the specified condition is satisfied. A loop is composed of two components: the loop's body and a control statement. The control statement is a collection of conditions that tells the loop's body to continue running until the provided condition turns false. The loop aims to execute the same code repeatedly. While A 'While Loop' is used to repeatedly execute a specified piece of code until a condition is fulfilled. For instance, we want to show the numbers between 0 and 10; the initialization sets to zero, and as long as the value is less than ten, the loop will be executed. It uses an increment operator to increase the value by one.<jupyter_code>## while loop
a, b = 0, 10
while(a<=b):
  print(f"{a}\t|\t{a}")
  a+=1<jupyter_output><empty_output><jupyter_text>For A 'For Loop' statement is a control flow statement used to repeatedly express iteration of executing code. For example, this activity sets the starting value to zero with the range of eleven, and the variable will increment 1. However, the loop will stop when the integer value is equivalent to ten or when the total number of variables is eleven.<jupyter_code># for(int i=0; i<10;; i++){
# printf(i)    
# }

i=0
for i in range(11):
 print(i)
playlist = ["Tadhana", "Dungaw", "Paraluman"]
print('Now Playing:\n')
for song in playlist:
  print(song)<jupyter_output>Now Playing:

Tadhana
Dungaw
Paraluman<jupyter_text>FLow Control Control flow, or flow of control, is the sequence in which function calls, instructions, and statements are performed or assessed during the execution of a program. One of the common examples of a control flow statement is the else/if statement, which is shown below.  Condition Statements Conditional statements are used in various programming languages to direct the computer on what to do when certain circumstances are met. These judgments are made if and only if the programmer's pre-defined criteria are true or false. We set different values for two variables and three conditions, in this circumstance, including the default statement of all the conditional expressions. The printed output for this activity is 'Aww' since the given values didn't fall on the "if" and "else if" statements.<jupyter_code>numeral1, numeral2 = 12, 13
if(numeral1 == numeral2):
  print("Henlo")
elif(numeral1>numeral2):
  print("Kurek")
else:
    print("Chariz")<jupyter_output>Chariz<jupyter_text>Functions  In programming, functions refers to a code that carries out specific actions when used. For example, the code "print" is used to show the text you want to be shown in your program.<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 = "RJ"
delete_user("RJ")
delete_all_users()
def add(addend1, addend2):
  return addend1 + addend2

def power_of_base2(exponent):
  return 3**exponent
#addend1, addend2 = 34, 20
#add(addend1, addend2)

exponent = 10
power_of_base2(exponent)<jupyter_output><empty_output><jupyter_text>Grade Calculator<jupyter_code>p , m , f = 0.3,0.3,0.4
b = 70
name = input("Enter Name: ")
course = input("Enter Course: ")
prelim = input("Enter Prelim Grade: ")
prelim = float (prelim)
midterm = input("Enter Midterm Grade: ")
midterm = float (midterm)
finalterm =  input("Enter Finalterm Grade: ")
finalterm = float (finalterm)
Semestral_Grade = (prelim*p)+(midterm*m)+(finalterm*f)
print("Hi {} from {}. Your Semestral Grade is {:.2f}".format(name, course, Semestral_Grade)) 
if(Semestral_Grade==b):
    print("\U0001F606")
elif(Semestral_Grade>b):
    print("\U0001F600")
else: 
    print("\U0001F62D")<jupyter_output>Enter Name: <NAME>
Enter Course: B.S Chemical Engineering
Enter Prelim Grade: 95.35
Enter Midterm Grade: 93.67
Enter Finalterm Grade: 98.54
Hi <NAME> from B.S Chemical Engineering. Your Semestral Grade is 96.12
😀
{'fraction_non_alphanumeric': 0.08402203856749312, 'fraction_numerical': 0.017376562831108285, 'mean_word_length': 5.042893725992317, 'pattern_counts': {'":': 0, '<': 47, '<?xml version=': 0, '>': 47, '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': '527429', 'license': 'Apache-2.0', 'n_tokens_mistral': 2892, 'n_tokens_neox': 2740, 'n_words': 1290, 'path': 'Activity_1_Python_Fundamentals.ipynb', 'repo_name': 'itsCiandrei/LinearAlgebra_2ndSem', 'size': '9452'}