# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     name: python3
# ---

# + [markdown] id="view-in-github" colab_type="text"
# <a href="https://colab.research.google.com/github/silvertounge00/Linear-Algebra_ChE_2nd-Sem-2021-2022/blob/main/Activity_1_Python_Fundamentals.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>

# + [markdown] id="GZGZrmvqHRql"
# ## Welcome to Python Fundamentals
# In 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

# + [markdown] id="MHQmxmhMHbDQ"
# Variable and Data Types

# + colab={"base_uri": "https://localhost:8080/"} id="H4huFtVrHglQ" outputId="0fb81bbd-b80b-423f-9e3a-695431e2912e"
x = 8
a,b = 0,-4
b

# + colab={"base_uri": "https://localhost:8080/"} id="WHa6-UvbHr3W" outputId="6f3daaa3-8344-46aa-f2ec-7ce3ff3536f9"
type(a)
int

# + colab={"base_uri": "https://localhost:8080/"} id="cqO4dAezHxdd" outputId="97a429e7-098a-4771-8ef7-5b177a5c9517"
y= 2.5
type(y)

# + colab={"base_uri": "https://localhost:8080/"} id="io_2KXkLH37G" outputId="f3c0baad-a9aa-4a06-c22c-696adb2d861b"
x= float(x)
type (x)

# + colab={"base_uri": "https://localhost:8080/"} id="49cHKweQI3W5" outputId="229f1451-62b9-4fd3-a555-085463c3a8cb"
c,h,e ="0", '2', 'three'
type (u)

# + colab={"base_uri": "https://localhost:8080/"} id="cM9vxi7IJNLN" outputId="c25e426a-f456-490a-c33a-357122f7cd64"
s_int = int(s)
s_int

# + [markdown] id="C_ssg1-vJeN2"
# ##Operations

# + [markdown] id="qbYXRgdoJrQy"
# ###Arithmethic

# + id="z9lQjesnJwIv"
n,i,c,a=1.0, 2.0, 3.0, 4.0

# + colab={"base_uri": "https://localhost:8080/"} id="uoBiyA_pKWgN" outputId="2a2bfc17-4b59-4bae-be52-dbbb046955c5"
#Addition
S=n+i
S

# + colab={"base_uri": "https://localhost:8080/"} id="tYQ5Q2hdK4v8" outputId="dbb2ed10-5cf2-4251-8737-821221bf05de"
###Subtraction
D= i-a
D

# + colab={"base_uri": "https://localhost:8080/"} id="qNT6mGuOLRZ1" outputId="d89f49a5-c52c-4903-882b-1fc3d6204bf9"
### Multiplication
P=n*i
P

# + colab={"base_uri": "https://localhost:8080/"} id="zqHGf-0wLnao" outputId="aafe465e-51b5-4929-d29c-2528381bfa30"
###Division
Q= n/i
Q

# + colab={"base_uri": "https://localhost:8080/"} id="aSCT4FAjL14O" outputId="0a33df50-45d8-4f6e-a259-8efbf823bac9"
###Floor Division
Fq = n//i
Fq

# + colab={"base_uri": "https://localhost:8080/"} id="H65AKSUoMCRf" outputId="49d29729-fc7b-4989-b0f7-c1e55e2c8f64"
### Exponentiation
E = n**i
E

# + colab={"base_uri": "https://localhost:8080/"} id="ERblO-k9MP1B" outputId="ca1958f7-d44a-49e8-c4d0-eb4a30131aeb"
### Modulo
mod = a%n
mod

# + [markdown] id="L5dhl2A0S0vP"
# ##Assignment Operations

# + id="KrlAFyYJTB1c"
C, U, T, E = 5.0, 6.0, 7.0, 8.0

# + colab={"base_uri": "https://localhost:8080/"} id="WniLaVWGTJZj" outputId="bf794948-16a6-4eab-b603-809a4ec69375"
C += n
C

# + colab={"base_uri": "https://localhost:8080/"} id="l2raQOSETUAj" outputId="4b283f78-4d5f-4c1c-f4c7-2cfae6faa919"
E -= a
E

# + colab={"base_uri": "https://localhost:8080/"} id="za1tB5IRTdkG" outputId="75842b22-0f07-4d67-eeea-c156a038338d"
T *= 7.0
T

# + colab={"base_uri": "https://localhost:8080/"} id="NntG_vbqTl_U" outputId="304db5eb-4261-4143-852f-cb2530eb8009"
E **8.0
E

# + [markdown] id="SKvgBzPbTuTL"
# ###Comparators

# + id="jX0dz_ooTy_N"
res_1, res_2, res_3 = 1, 2.0, "1"
true_val= 1.0

# + colab={"base_uri": "https://localhost:8080/"} id="KFL6MzmdUCCj" outputId="5025938b-dc44-4c04-91e2-afb0008ab208"
## Equality
res_1==true_val

# + colab={"base_uri": "https://localhost:8080/"} id="UEszL0HTUJd8" outputId="3234eb72-4bfc-44b2-f442-41493af1649b"
## Non_equality
res_1==true_val

# + colab={"base_uri": "https://localhost:8080/"} id="1ppj9rvkUQ0i" outputId="8d0de564-9a71-4684-9c7c-9ea1d6e6780e"
## Inequality
t1=res_1 >res_2
t2= res_1 <res_2/2
T3= res_1 >= res_2/2
t4= res_1 <=res_2
t4

# + [markdown] id="H-a64u_LUzKM"
# ###Logical

# + colab={"base_uri": "https://localhost:8080/"} id="VzQ2DQnIU107" outputId="95c65da3-c6a5-4c59-b204-c0cd8862fbed"
res_1 == true_val

# + colab={"base_uri": "https://localhost:8080/"} id="o7yYAwJXU9dj" outputId="bf4c7b88-493c-408f-9b2b-e3666877cf9a"
res_1 is true_val

# + colab={"base_uri": "https://localhost:8080/"} id="6OA_tsj3VBqb" outputId="f1a55275-0a6d-4e1c-f98c-7ed7c2759523"
res_1 is not true_val

# + colab={"base_uri": "https://localhost:8080/"} id="C2x8KM5UVGl1" outputId="8b2b24d9-0393-4e80-c99c-8fe0af19e662"
p, q = True, False
conj = p and q
conj

# + colab={"base_uri": "https://localhost:8080/"} id="33gDlX4AVQGy" outputId="a8e5a6bd-dd1b-4e41-a305-51c24d0a12e5"
p, q = True, False
disj = p or q
conj

# + [markdown] id="72nhig4uVcyE"
# ###l/O

# + colab={"base_uri": "https://localhost:8080/"} id="GlGpeoo_WHMl" outputId="b60dfe7a-7b84-4401-db7c-f69d78ec90a4"
print("si sir magpapaulan ng uno")

# + id="mjqh0SI55s3t"
cnt=1

# + colab={"base_uri": "https://localhost:8080/"} id="vuj6hgUW5vpj" outputId="546f4154-d9ae-4281-a8f1-4291b1429d76"
string = "si sir magpapaulan ng uno yan"
print(string, ",Current run count is", cnt)
cnt +=1

# + colab={"base_uri": "https://localhost:8080/"} id="Z-Bhrq0Z6Ghb" outputId="4c02e75c-1eae-4281-cf5f-d8cba1d7703a"
print(f"{string}, Current count is: {cnt}")

# + colab={"base_uri": "https://localhost:8080/"} id="QgHTM8UB6f6a" outputId="ea32fc6d-8f5f-4cd3-f68d-594ea6282f3b"
sem_grade = 90.123456789101213
name = ""
print("Congrats {}, your semestral grade is: {}".format(name, sem_grade))

# + colab={"base_uri": "https://localhost:8080/"} id="LOosuG0p8Ivb" outputId="a283f58e-1ea2-4b10-a8a8-21c96dcea6dc"
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))

# + colab={"base_uri": "https://localhost:8080/", "height": 53} id="UfS-427U9M0m" outputId="8f74000a-ce1d-4161-b673-8664ea9de171"
x = input("Input your name: ")
x

# + id="AEzNatys2E5s" outputId="75ba9942-ad08-4ada-85be-e56589ceb85b" colab={"base_uri": "https://localhost:8080/"}
name = input("Silvertounge: ")
pg = input("Enter prelim grade: ")
mg = input("Enter midterm grade: ")
fg =  input("Enter finals grade: ")
sem_grade = 90
print("Hello {}, your semestral grade is: {}".format(name, sem_grade))

# + [markdown] id="kbajUjHk39VM"
# # Looping Statements

# + [markdown] id="Xh6qJRgk4AdS"
# ###While

# + id="ZTZ0OspO4Jv-" outputId="c8806fce-84d2-4485-aae9-a7136da761fe" colab={"base_uri": "https://localhost:8080/"}
## while loops
i, j = 0, 10
while(i<=j):
    print(f"{i}\t|\t{j}")
    i+=1

# + [markdown] id="b7OUK8ONNBi1"
# ### For

# + id="JdlDy2mg42pF" outputId="537c47a0-05c8-47af-8eae-4482d08bba84" colab={"base_uri": "https://localhost:8080/"}
# for(int i =0; i<10; i++){#printf(i)#}

i=0
for i in range(11):
    print(i)

# + id="bKmGyqWm57GS" outputId="6013dcc8-e289-465e-c039-d6dc690feecd" colab={"base_uri": "https://localhost:8080/"}
playlist = ["Unwell", "Perfect", "Iris"]
print('Now Playing:\n')
for song in playlist:
  print(song)

# + [markdown] id="C3dDhF-K6b77"
# #Flow Control

# + [markdown] id="VUpyvQWe6h-k"
# ###Condition Statements

# + id="fwZwVHIs6nLJ" outputId="940301a5-cb01-4eb1-8b10-c76d43ad23fd" colab={"base_uri": "https://localhost:8080/"}
numeral1, numeral2, = 33, 19
if(numeral1 == numeral2):
  print("frfr")
elif(numeral1>numeral2):
  print("ngl")
else:
  print("istg")


# + [markdown] id="i3jwapc37UXB"
# #Functions

# + id="257RAivS7anx"
# void Delete(int userid){
# deleter(userid):
#}

def delete_user(userid):
  print("Succesfully deleter user:{}".format(userid))
def delete_all_users():
  print("succesfully deleted all users")


# + id="Y68GhriE8M5c" outputId="a76b4cec-5fed-4c3e-938c-bdfbc75871b6" colab={"base_uri": "https://localhost:8080/"}
userid= 202010126
delete_user(202010126)
delete_all_users()


# + id="376aItxN_6yp" outputId="9a84bd8e-e310-41f5-c162-f207f0975b16" colab={"base_uri": "https://localhost:8080/"}
def add(addend1, addend2):
    print("I know how to add addend1 and addend2")
    return addend1 + addend2


def power_of_base2(exponent):
    return 2**exponent
  
addend1 = 100
addend2 = 500

exponent = 100

#add(addend1, addend2)
power_of_base2(exponent)

# + [markdown] id="V0uhWwVkNdG8"
# #Calculator

# + id="DFGeAlY9QKrr" outputId="52c6b6c4-54ae-432e-e1d6-2b646c484e63" colab={"base_uri": "https://localhost:8080/"}
print()
name = input('\tWhat is your name?');
course = input('\tWhat is your course');
prelim = float(input('\tGive Prelim Grade : '));
midterm = float(input('\tGive Midterm Grade : '));
final = float(input('\tGive Final Grade : '));
grade = (prelim) + (midterm) + (final);
average = grade/3;

print();
print("\t===== DISPLAYING RESULTS =====");
print();
print("\tYour name is", name , "and your course is", course);
print();
if average > 70:
  print("\tYour grade is \U0001F600");
elif average == 70:
  print("\tYour grade is \U0001F606");
elif average < 70:
    print("\tYour grade is \U0001F62D");
print();

StarcoderdataJupyterScriptsDedupFiltered