問題一覧
1
24-(-8*4-(100+32)/3)
100.0
2
1118%3
2
3
4**3
64
4
import math math.pow(2,3)
8
5
import math math.sqrt(4)
2
6
import math math.sin(math.radians(180))
0
7
import math math.log10(100)
2.0
8
import math math.sin(math.pi/2)
1.0
9
print('{:.2g}'.format(3**5))
2.4e+02
10
"Hello World"
'Hello World'
11
"He said \"Hello World\""
'He said "Hello World"'
12
a=100 type(a)
int
13
a=3.5 type(a)
float
14
a="hello" type(a)
str
15
x=1,y=2 x+=y x+3
6
16
x=2 y=3 x**=y x+2
10
17
1+2 2*8+6
22
18
b=5 print(b) b=b+6 b b=b+7 print(b)
5 18
19
1 > 6 and 5 < 12
False
20
5 != 3
true
21
3 > 2 or 1 < 0
True
22
i=1 s=0 while i<=3: s+=i*2 i+=1 print(s)
12
23
for i in range(5): print(2*i)
0 2 4 6 8
24
a=range(1,10,3) list(a)
[ 1,4,7 ]
25
a="1234567890987654321" a.find("67")
5
26
a="1234567890987654321" a.rfind("76")
12
27
a="1234567890987654321" a.rfind("49")
-1
28
worera=[26,96,99] worera
[26,96,99]
29
worera=[26,96,99] worera[0]
26
30
worera=[26,96,99] len(worera)
3
31
worera=[26,96,99] for i in worera: print(i)
26 96 99
32
worera=[26,96,99] worera.append(120) len(worera)
4
33
worera=[26,96,99] worera[1]=(120) worera
[26,120.99]
34
mix3=[-4,"5","abc",5] mix3_update=[0 if type(i) is str else i for i in mix3] mix3=mix3_update mix3
[-4,0,0,5]
35
worera=[26,96,99] del worera[1] len(worera)
2
36
mix4=[-4,"5",5,"5"] mix4.remove("5") mix4
[-4,5,'5']
37
mix5=[-4,"5",5,"5",6] mix5_update=[i for i in mix5 if i != "5"] mix5=mix5_update mix5
[-4,5,6]
38
worera=[26,96,99] max(worera)
99
39
worera=[26,96,99] min(worera)
26
40
worera=[26,96,99] sum(worera)
221
41
worera=[26,96,99] 10 in worera
False
42
worera=[["千夏",26],["瑞季",96],["景",99]] worera[2]
['景',99]
43
worera=[["千夏",26],["瑞季",96],["景",99]] worera[0][1]
26
44
worera=[["千夏",26],["瑞季",96],["景",99]] s=0 for i in worera: s+=i[1] s
221
45
worera={"千夏":26,"瑞季":96,"景":99} worera["千夏"]
26
46
worera={"千夏":26,"瑞季":96,"景":99} worera["藍子"]=10 worera
{'千夏': 26, '瑞季': 96, '景': 99, '藍子': 10}
47
worera={"千夏":26,"瑞季":96,"景":99} worera.update(藍子=10,まりも=31,玲菜=73,灯=87) worera
{'千夏': 26, '瑞季': 96, '景': 99, '藍子': 10, 'まりも': 31, '玲菜': 73, '灯': 87}
48
worera={"千夏":26,"瑞季":96,"景":99} worera.update(藍子=10,まりも=31,玲菜=73,灯=87) worera.pop("瑞季")
96
49
worera={"千夏":26,"瑞季":96,"景":99,"藍子":10,"まりも":31,"玲菜":73,"灯":87} del worera["藍子"],worera["まりも"],worera["玲菜"],worera["灯"] worera
{'千夏': 26, '瑞季': 96, '景': 99}
50
worera={"千夏":26,"瑞季":96,"景":99} "景" in worera
True
51
worera={"千夏":26,"瑞季":96,"景":99} tonari={"藍子":10,"まりも":31,"玲菜":73,"灯":87} worera.update(tonari) nananin=worera nananin
{'千夏': 26, '瑞季': 96, '景': 99, '藍子': 10, 'まりも': 31, '玲菜': 73, '灯': 87}
52
worera={"千夏":26,"瑞季":96,"景":99,"藍子":120} tonari={"藍子":10,"まりも":31,"玲菜":73,"灯":87} worera.update(tonari) nananin=worera nananin
{'千夏': 26, '瑞季': 96, '景': 99, '藍子': 10, 'まりも': 31, '玲菜': 73, '灯': 87}
53
l=[1,4,10,3] import statistics statistics.mean(l)
4.5
54
l=[1,4,10,3] l.append(3) import statistics statistics.mode(l)
3
55
l=[1,4,10,3] l.append(3) import statistics m=statistics.mode(l) l.count(m)
2
56
l=[0,4,8,2,6] import statistics statistics.mean(l)
4
57
m=[7,4,6,5,6,7,2,6,0,7] statistics.mode(m)
7
58
m=[7,4,6,5,6,7,2,6,0,7] statistics.multimode(m)
[7,6]
59
def isodd(x): if (x%2==1): return True else: return False isodd(5)
True
60
x=10 def printX(): print(x) printX()
10
61
x = 100 def test(): x = 3 print(x) print(x) test() print(x)
100 3 100
62
x = 100 def test(): global x x = 3 print(x) print(x) test() print(x)
100 3 3