-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathsolutions.py
More file actions
97 lines (78 loc) · 2.34 KB
/
solutions.py
File metadata and controls
97 lines (78 loc) · 2.34 KB
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#Declare two variables num1 and num2 and assign it a number value of your choosing.
num1 = 8
num2 = 3
#1. Addition
#Add the two variables and store it to a new variable named total.
#Print the total variable.
total = num1 + num2
print(total)
#2 Subtraction
#Subtract the two variables and store it to a new variable named difference.
#Print the difference variable.
difference = num1 - num2
print(difference)
#3 Multiplication
#Multiple the two variables and store it to a new variable named product.
#Print the product variable.
product = num1 * num2
print(product)
#4 Division
#Divide the two variables and store it to a new variable named quotient.
#Print the quotient variable.
quotient = num1 / num2
print(quotient)
#5 Modulus
#Find the modulus of the two variables and store it to a new variable named remainder.
#Print the remainder variable.
remainder = num1 % num2
print(remainder)
#6 Exponent
#Find the square of the num1 and store it to a new variable named double.
#Print the double variable.
double = num1 ** 2
print(double)
#7 Floor Division
#Divide the two variables to find the rounded down integer and store it to a new variable named int_div.
#Print the int_div variable.
int_div = num1 // num2
print(int_div)
#8 Comparison and Logic
#Declare a variable named is_equal and compare two strings 'Tacocat' and 'tacocat' using the equality (==) operator.
#Print the is_equal variable.
is_equal = 'Tacocat' == 'tacocat'
print(is_equal)
#9 Declare a variable named not_equal and compare the string value of '8' with the number value 8 using the inequality (!=) operator.
#Print the not_equal variable.
not_equal = '8' != 8
print(not_equal)
#10 Assignment
#Declare a variable named num3 and assign it a number of your choosing.
num3 = 11
#Increment and assign 5 to the num3 variable.
#Print your results.
num3 += 5
print(num3)
#Decrement and assign 7 to the num3 variable.
#Print your results.
num3 -= 7
print(num3)
#Multiple and assign 3 to the num3 variable.
#Print your results.
num3 *= 3
print(num3)
#Divide and assign 2 to the num3 variable.
#Print your results.
num3 /= 2
print(num3)
#Modulus and assign 8 to the num3 variable.
#Print your results.
num3 %= 8
print(num3)
#Exponent and assign 3 to the num3 variable.
#Print your results.
num3 **= 3
print(num3)
#Floor divide and assign 4 to the num3 variable.
#Print your results.
num3 //= 4
print(num3)