python第二章練習問題
935 ワード
2-1
出力結果:
I am a fresh man!!!
2-2
出力結果:
2
haha
2-3
出力結果:
Hello Eric, would you like to learn some Python today?
2-4
出力結果:
luffy
LUFFY
Luffy
2-8
出力結果:
8
8
8
8.0
2-9
出力結果:
my favorite num is 7.
string = "I am a fresh man!!!"
print(string)
出力結果:
I am a fresh man!!!
2-2
temp = 2
print(temp)
temp = "haha"
print(temp)
出力結果:
2
haha
2-3
name = "Eric"
print("Hello " + name + ", would you like to learn some Python today?")
出力結果:
Hello Eric, would you like to learn some Python today?
2-4
name = "luffy"
print(name.lower())
print(name.upper())
print(name.title())
出力結果:
luffy
LUFFY
Luffy
2-8
print(3 + 5)
print(10 - 2)
print(2 * 4)
print(16 / 2)
出力結果:
8
8
8
8.0
2-9
my_favorite_num = 7
my_favorite_num = "my favorite num is " + str(my_favorite_num) + "."
print(my_favorite_num)
出力結果:
my favorite num is 7.