forked from calistus-igwilo/python
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprint.py
46 lines (34 loc) · 939 Bytes
/
print.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
# """
# Assing twor variables that store the follwing values:
# - $34.99 - product price (float)
# - 20 lbs - product weight (int)
# Using the f-string formatting style print to the console with
# the following message:
# Price: $34.99. Weight: 20 lbs.
# """
# price = 34.99
# weight = 20
# print(f'Price: ${price}. Weight: {weight} lbs.')
"""
Below is an approximation of pi:
pi = 3.1415926535
using f-string formatting, print the approximation of pi to two
decimal places as shown below:
Pi: 3.14
"""
pi = 3.1415926535
print(f'Pi: {pi :.2f}')
# New code
"""
Using three pirnt() functions (one line - one function)
print the following text:
-----------------------------------------
VERSION: 1.0.1
-----------------------------------------
Tip: The lines consist of 40 dash characters '-'
"""
print('-'*40)
print('VERSION: 1.0.1')
print('-'*40)
# New code: sep argument
print('summer', 'time', 'holiday', sep='#')