-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
43 lines (27 loc) · 1.63 KB
/
main.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
#Jaunel Deans
#September 28, 2023
#We are predicting the outcome of the input statments and reflecting if we have the right answer.
print(8 + 2)
## The output will be 10 because only intergers and floats can be calcualated and we are adding 8 and 2.
### I was correct.
print( 8 - 2)
## The output would be 6 because we are subtracting 2 from 8.
### It was the right answer.
print(8 * 2)
## The output will be 16 because we are multplying 8 and 2.
### I was correct
print(10 / 4)
## The output will be 2.5 because we are dividing.
### The answr was 2.5
print(10 // 4)
## TIt will divide 10 by 4 but only produce the whole number which is 2.
### The answer was 2.
num1 = 20 ## We are assigning the number 20 to the variable num1
num2 = 5 ## We are assigning 5 to the variable num2
result = num1 * num2 ## Then we are assigning the product of the values in num1 and num 2 to the variable result
print(result) ## The value in the variable result will be displayed which is 100
print("Enter a number") ## The computer will print out the statement, "Enter a number"
num1 = int(input()) ## The computer will then ask and accept an input of an interger only. The value will be assigned to the variable num1.
num2 = 2 ## The variable num2 is assigned the value 2.
result = num1 // num2 ##The value in num1 is divided by the value in num2. The answer will be the whole number in answer due to the intergral division symbol. The answer will be assigned to results. If i were to enter 5, the result of division would be 2.5 but it will only output the interger part of the number.
print(result)## The value in the variable result will be displayed