1. 程式人生 > >笨辦法學Python3——習題6 字串和文字

笨辦法學Python3——習題6 字串和文字

【程式碼】

 

types_of_people = 10
x = f"There are {types_of_people} types of people."

binary = "binary"
do_not = "dont't"
y = f"Those who know {binary} and those who {do_not}."

print(x)
print(y)

print(f"I said: {x}")
print(f"I also said: '{x}'")

hilarious = "False"
joke_evalution = "Isn't that joke so funny?!{}
" print(joke_evalution.format(hilarious)) w = "This is the left side of…" e = "a string with a right side." print(w+e)

 

【輸出結果】

There are 10 types of people.
Those who know binary and those who dont't.
I said: There are 10 types of people.
I also said: 'There are 10 types of people.'
Isn't that joke so funny?!False
This is the left side of…a string with a right side.