File tree Expand file tree Collapse file tree 1 file changed +48
-1
lines changed Expand file tree Collapse file tree 1 file changed +48
-1
lines changed Original file line number Diff line number Diff line change 44@author: syuu
55'''
66
7+ import math
8+ from builtins import input
9+
710if __name__ == '__main__' :
8- print ("Hello World" )
11+
12+ def test_array ():
13+ for u in ['Tokyo' , 'Osaka' , 'Fukuoka' ]:
14+ print (u )
15+ s = []
16+ for u in range (5 ):
17+ s .append (u * 2 )
18+ print (s )
19+ print (s [2 :5 ])
20+
21+ input = [1 , 3 , 5 , 7 , 9 ]
22+ outputArr = [u * 2 for u in input if u > 3 ]
23+ print (outputArr )
24+
25+ def test_math ():
26+ x = 1 / 2
27+ print (math .floor (x ))
28+ print (math .ceil (x ))
29+
30+
31+ def test_dictionary ():
32+ dic = {'mouse' :1 , 'cow' :2 , 'pig' :3 , 'tiger' :4 }
33+ print (dic ['cow' ])
34+ print (dic .items ())
35+ print (dic .keys ())
36+ print (dic .values ())
37+ outputDic = {u :v + 100 for u , v in dic .items ()}
38+ print (outputDic .items ())
39+ print (sorted (dic .items (),key = lambda u :u [1 ],reverse = True ))
40+
41+ def test_enumerateAndZip ():
42+ input = ['Tokyo' , 'Osaka' , 'Fukuoka' ]
43+ for i ,v in enumerate (input ):
44+ print (i ,v )
45+ num = [10 ,20 ,30 ]
46+ for u in zip (input ,num ):
47+ print (u )
48+
49+ print ("Hello World" )
50+ test_array ()
51+ test_math ()
52+ test_dictionary ()
53+ test_enumerateAndZip ()
54+
55+
You can’t perform that action at this time.
0 commit comments