-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathLesson001.py
55 lines (42 loc) · 3.09 KB
/
Lesson001.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
i = 0 # Assigning a value to a Variable
print("BASICS OF PYTHON | GITHUB/NARCOTIC | LESSON-001") # Print to Screen
print() # Print an Empty Line
x = int(input("Enter x Value : ")) # Input a value to a Integer Variable
y = int(input("Enter y Value : ")) # Input a value to a Integer Variable
common_factor = int(input("Enter Common Factor : ")) # Input a value to a Integer Variable
name = input("Enter Your Name : ") # Input a String
sum_xy = x + y # Addition
dif_xy = x - y # Substraction
product_xy = x * y # Multiplication
division_xy = x / y # Division
floorDivision_xy = x // y # Floor division
Exponentiation_xy = x ** y # Exponentiation
print()
print("Hello ", name) # Printing a String with other Text
print()
print("Sum of x and y is :", sum_xy) # Sum
print("Difference of x and y is :", dif_xy) # Difference
print("Product of x and y is :", product_xy) # Product
print("Quotient of x and y is :", division_xy) # Quotient
print("Floor Division of x and y is :", floorDivision_xy) # Floor
print("Exponentiation of x and y is :", Exponentiation_xy) # Exponentiation
print()
if (sum_xy % 2) == 0: # If the Remainder of sum_xy is 0 after deviding by 2
print("Sum of x and y is Even") # In other words: if sum_xy is Even
else: # If the Remainder of sum_xy is 1 after deviding by 2
print("Sum of x and y is Odd") # In other words: if sum_xy is Odd
if sum_xy < 0: # If sum of x and y is less than 0
print("Sum of x and y is a Negative Number")
elif sum_xy > 0: # Else If sum of x and y is greater than 0
print("Sum of x and y is a Positive Number")
else: # Else sum of x and y is = 0
print("Sum of x and y is 0")
if x % common_factor == 0 and y % common_factor == 0: # Using 'and' Logical Operation with if Condition
print("x and y both have common factor:", common_factor)
elif x % common_factor == 0 or y % common_factor == 0: # Using 'and' Logical Operation with if Condition
print("x or y has common factor:", common_factor)
else: # Else
print("x or y does not have common factor:", common_factor)
print()
print("THAT'S IT FOR FIRST LESSON. TAKE A LOOK AT THE SECOND ONE")
print("@ -> GITHUB/NARCOTIC/PY-NOOB")