forked from codedlabs/python-cw-1
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
28 lines (25 loc) · 1.18 KB
/
main.py
File metadata and controls
28 lines (25 loc) · 1.18 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
# Change the following print statement so that it uses the addition operator + and prints out 8
print(3)
print(3+5)
# Write a print statement that uses the division operator /
print(12/3)
# Add a print statement that uses multiplication *
print(6*6)
# Create a variable called `length` and assign a value to it
length = 5
# Create a variable called `width` and assign a value to it
width = 3
# Create a variable called `area` and assign to it the multiplication of `length` and `width`
area = length * width
# Print `area` in the following: "The result is " followed by the `area` variable
print(f"The result is {area}")
# BONUS: Print the area in the following syntax: "If the length of a rectangle is 5, and width is 3 then the area is: 15". Keep in mind that you should replace the numbers with their respective variables.
print(f"If the length of a rectangle is {length}, and width is {width} then the are is {area}")
#Require the user to input their name, age, and hobbies
print("Please type your name: ")
x = input()
print("Please write your age: ")
y = input()
print("Please write list your hobbies: ")
z = input()
print(f"Your name is {x} and you are {y} years old. Your hobbies are: {z}")