This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
u = random.uniform(1,5) | |
print(u) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
r = random.random() | |
print(r) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
detarame = random.random() | |
print(detarame) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
stationery = { | |
'消しゴム':50, | |
'シャープペンシル':100, | |
'マーカーペン':150, | |
'3色ボールペン':300 | |
} | |
for name in stationery.keys(): | |
price = stationery[name] | |
text = "{0}は、{1}円です。".format(name,price) | |
print(text) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
number_dict = { | |
'1': "王貞治", | |
'3': "長嶋茂雄", | |
'4': "黒沢俊夫" | |
} | |
del number_dict['1'] | |
print(number_dict) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
number_dict = { | |
'1': "王貞治", | |
'3': "長嶋茂雄", | |
'4': "黒沢俊夫" | |
} | |
number_dict['1'] = "世界の王" | |
number_dict['14'] = "沢村栄治" | |
print(number_dict) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
number_dict = { | |
'1': "王貞治", | |
'3': "長嶋茂雄", | |
'4': "黒沢俊夫" | |
} | |
print('2' in number_dict) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
number_dict = { | |
'1': "王貞治", | |
'3': "長嶋茂雄", | |
'4': "黒沢俊夫" | |
} | |
print('沢村栄治' in number_dict) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
number_dict = { | |
'1': "王貞治", | |
'3': "長嶋茂雄", | |
'4': "黒沢俊夫" | |
} | |
print(number_dict.keys()) | |
print(number_dict.values()) | |
print(number_dict.items()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
number_dict = { | |
'1': "王貞治", | |
'3': "長嶋茂雄", | |
'4': "黒沢俊夫" | |
} | |
print(number_dict['1']) |