-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathweek2-classwork
More file actions
67 lines (45 loc) · 1.73 KB
/
week2-classwork
File metadata and controls
67 lines (45 loc) · 1.73 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
# prompting user for first name and saving in variable
first_name = input("Enter first name: ")
# prompting user for last name and saving in variable
last_name = input("Enter last name: ")
# using formatting to print to the console
print(f"Hello {first_name} {last_name}")
# prompting user for birth month
birth_month = input("Enter birth month: ")
# prompting user for user name
user_name = input("Enter user_name: ")
# print to console
print(birth_month)
print(f"{user_name}, your birth month is {birth_month}.")
# prompting user for a number
first_number = int(input("Enter first number: "))
# prompting user for a second number
second_number = int(input("Enter second number: "))
# print sum to console
print(first_number + second_number)
# create variable 1
var1 = 20
# create variable 2
var2 = 10
# print the difference of the variables
print(var1 - var2)
# print the product of the variables
print(var1 * var2)
# print the quotient of the variables
print(var2 / var1)
# print the remainder of the variables
print(var2 % var1)
# prompting user for a first floating point number
float1 = float(input("Enter a float: "))
# prompting usr for a second floating point number
float2 = float(input("Enter a second float: "))
# Create a new variable and initialize it to the sum of the variables
float3 = (float1 + float2)
# Create a new variable and initialize it to the difference of the variables
float4 = round((float1 - float2), 1)
# Create a new variable and initialize it to the product of the variables
float5 = round((float1 * float2), 1)
# Create a new variable and initialize it to the quotient of the variables
float6 = round((float1 / float2), 1)
# Print all values to the console
print(float1, float2, float3, float4, float5, float6)