<jupyter_start><jupyter_text><jupyter_code><jupyter_output><empty_output><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 A variable's data type means that it limits the number of values it can hold and the operations that it can do on it. It can, for example, include a variety of values and procedures that can carry on it. The processor allocates memory and chooses what can be put in reserved memory based on a variable's data type.<jupyter_code>x = 1
a,b = 0, -1
a
type (x)

y = 0.1
type (y)

x= (x)
type (x)

x= float (x)
type (x)
s,t,u = "0",'1','one'
type(s)

s_int = int (s)
s_int
t_int = int(t)
type(t)

s_int = int (s)
s_int<jupyter_output><empty_output><jupyter_text>Operations Arithmetic The everyday fundamental arithmetic operations are division, subtraction, multiplication, and addition. With two operands, these arithmetic operators  known as binary arithmetic operators. Constants or variables can  used as operands.<jupyter_code>a,b,c,d = 2.0, -0.7, 0, -32<jupyter_output><empty_output><jupyter_text><jupyter_code>from typing import ByteString
### 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 Operation The right-hand operand of the assignment operations is assigned to a variable, a property, or an indexer element supplied by the left-hand operand. The value assigned to the left-hand operand is the outcome of an assignment expression.<jupyter_code>G, H, J, K = 0, 100, 2, 2
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 When two values are compared together, they are referred to be comparators. It compares two  values and generates a result. It is most usually associated with numerical numbers, but it may also use for other sorts of data.<jupyter_code>res_1, res_2, res_3 = 1, 2.0, "1" 
true_val = 1.0
## Equality 
res_2 == 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 Logical operators are used to executing logical operations on variables' values. Either true or false is the value. The results of the truth values can use to determine the conditions.<jupyter_code>res_1 == true_val
res_1 is true_val
res_1 is not true_val
p,q = True, False
e = not(q)
e
p,q = True, False
xor = (not p and q) or  (p and not q)
xor
p,q = True, False 
conj = p and q 
conj 
p,q = True, False
conj = p or q 
conj<jupyter_output><empty_output><jupyter_text>I/O By evaluating the results, It is an input output code that opens a source code for both adding and reading<jupyter_code>print("Hello Mars")

cnt = 1
string = "Hello World"
print(string, ", Current run count is:", cnt)
cnt += 4
print(f"{string}, Current count is {cnt}")
sem_grade = 82.2435646557461234 
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 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 prelim grade: ")
mg = input("Enter midterm grade: ")
fg = input("Enter finals grade: ")
sem_grade = 99895
print("Hello {}, your semestral grade is: {}".format(name, sem_grade))<jupyter_output>Kimi no nawa: 99
Enter prelim grade: 89
Enter midterm grade: 5
Enter finals grade: 
Hello 99, your semestral grade is: 99<jupyter_text>Looping Statement If the specified requirement is met, the loop statement is a series of steps or a sequence of statements that are executed zero times or more.  While Based on the results, The While Loop is used to continuously execute a block of statements until a specific condition is fulfilled<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 It is shown in the results that when you have a block of code that you want to repeat a certain number of times, "for" loops are used based on the code results. The "for" statement time steps across a sequence's individuals in order, each time executing the block.<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:

<NAME><jupyter_text>Flow Control The sequence in which a program's code is executed is known as the control flow. Condition Statement If / Else / Else If conditional statements are conditional statements that have more than one condition, this is upon observing the codes.<jupyter_code>numeral1, numeral2 = 13,12
if (numeral1 == numeral2):
  print("Yey")
elif (numeral1>numeral2):
  print ("Hoho")
else:
    print ("Aww")
  #print ("Hip hip")<jupyter_output>Hoho<jupyter_text>Functions This code is written to do a certain task. A group of instructions that you want to run again and over again or that, because of their complexity, are best placed in a sub-program and called unless they're necessary is a function.<jupyter_code># void DeleteUser(int userid){
#    delete(userid);
# }

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

def delete_all_users ():
    print("Hello people")
userid = "Angel"
delete_user("Angel")
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 = 9
power_of_base2(exponent)<jupyter_output><empty_output><jupyter_text>lambda Lambda supports Python runtimes that allow you to analyze events with your code.<jupyter_code>w_pg, w_mg, w_fg = 0.3, 0.3, 0.4
name = input("Enter your name: ")
course = input("Enter your course: ")
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("Hello {} from {}, your semestral grade is: {}".format(name, course, round(sem_grade, 2))) 
if(sem_grade > 70.00):
      print("\U0001F600")
elif(sem_grade == 70.00):
      print("\U0001F606")
else:
      print("\U0001F62D")<jupyter_output>Enter your name: angelkathy
Enter your course: Chemical Engineering Major in Chismisan
Enter prelim grade: 99
Enter midterm grade: 99.9
Enter finals grade: 100
Hello angelkathy from Chemical Engineering Major in Chismisan, your semestral grade is: 99.67
😀
{'fraction_non_alphanumeric': 0.1099199542595769, 'fraction_numerical': 0.03101772441395083, 'mean_word_length': 4.88973063973064, 'pattern_counts': {'":': 0, '<': 54, '<?xml version=': 0, '>': 54, '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': '13', 'dir': 'jupyter-structured-clean-dedup', 'id': '463583', 'license': 'Apache-2.0', 'n_tokens_mistral': 2578, 'n_tokens_neox': 2414, 'n_words': 909, 'path': 'Activity_1_Python_Fundamentals.ipynb', 'repo_name': 'Angel30cansicio/LinearAlgebra_2ndSem', 'size': '7022'}