-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathex6.py
More file actions
30 lines (30 loc) · 1.43 KB
/
Copy pathex6.py
File metadata and controls
30 lines (30 loc) · 1.43 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
# setting a variable type_of_people to 10
type_of_people = 10
# setting a new formatted string variable 'x' which conatins text and variable type_of_people inside of it.
x = f"There are {type_of_people} types of people."
# setting new string named binary
binary = "binary"
# setting new string named do_not
do_not = "don't"
# settign new string named 'y' which contains text and two variables inside named 'binary' and 'do_not'
y = f"Those who know {binary} and those who {do_not}."
# prints out the variable x which is a formatted string
print(x)
# prints out the variable y which is a formatted string
print(y)
# prints out a formatted strings and a variable inside, which is also a formatted string 'x'
print(f"I said: {x}")
# prints out a formatted strings and a variable inside, which is also a formatted string 'y'
print(f"I also said: '{y}'")
# setting new boolean variable named 'hilarious' to False
hilarious = False
# setting new string variable named 'joke_evaluation' which takes one formatting parameter
joke_evaluation = "Isn't that joke so funny?! {}"
# prints out the formatted string joke_evaluation with format() function used and 'hilarious' boolean value passed to it
print(joke_evaluation.format(hilarious))
# setting a new string variable named 'w'
w = "This is the left side of..."
# setting a new string variable named 'e'
e = "a string with a right side."
#prints out the contatenation of two string variables 'w' and 'e'
print(w + e)