【Python爬虫類】-入学試験
1856 ワード
a = 10
b = 3
print('a+b = ', a + b)
print('a-b = ', a - b)
print('a*b = ', a * b)
print('a/b = ', a / b)
print('a**b = ', a ** b)
print('a/b = ', a / b)
print('a%b = ', a % b)
sum = 0
for value in range(1,101):
sum += value
print('1+2+3+4+.....+100 = ', sum)
sum = 0
for value in range(1,101):
if value % 2 == 0:
sum += value
print('1~100 ' + str(sum))
dict_date = {"Led Zeppelin":1969,
"Led Zeppelin II": 1969,
"Led Zeppelin III": 1970,
"Led Zeppelin IV": 1971,
"Houses of the Holy":1973,
"Physical Graffiti": 1975,
"Presence":1976,
"In Through the Out Door":1979,
"Coda":1982
}
for year in dict_date.values():
if year <= 1976 and year >= 1970:
print(str(year))
def value_exchange(a,b):
c = a
a = b
b = c
print(a,b)
list_a = [i for i in range (10) if i % 2]
print(list_a)
# 1~10( 1, 10) , ,i % 2 0,if i % 2 False, 。 list_a 1~10