1
+ # Integer
2
+ # If the integer is greater than or equal to 100, print "That's a big number!" If the integer is less than 100, print "That's a small number"
3
+
4
+ # String
5
+ # If the string is greater than or equal to 50 characters print "Long sentence." If the string is shorter than 50 characters print "Short sentence."
6
+
7
+ # List
8
+ # If the length of the list is greater than or equal to 10 print "Big list!" If the list has fewer than 10 values print "Short list."
9
+
10
+ def filter_type (el ):
11
+ if isinstance (el , int ):
12
+ print str (el ), "is a number"
13
+ if el >= 100 :
14
+ print "that's a big number"
15
+ else :
16
+ print "that's a small number"
17
+
18
+ if isinstance (el , str ):
19
+ print str (el ), "is a string"
20
+ if len (el ) >= 50 :
21
+ print "long sentence"
22
+ else :
23
+ print "short sentence"
24
+ if isinstance (el , list ):
25
+ print str (el ), "is a list"
26
+ if len (el ) >= 10 :
27
+ print "that's a long list"
28
+ else :
29
+ print "that's a short list"
30
+
31
+ filter_type (45 )
32
+ filter_type (100 )
33
+ filter_type (455 )
34
+ filter_type (0 )
35
+ filter_type (- 23 )
36
+ filter_type ("Rubber baby buggy bumpers" )
37
+ filter_type ("Experience is simply the name we give our mistakes" )
38
+ filter_type ("Tell me and I forget. Teach me and I remember. Involve me and I learn." )
39
+ filter_type ("" )
40
+ filter_type ([1 ,7 ,4 ,21 ])
41
+ filter_type ([3 ,5 ,7 ,34 ,3 ,2 ,113 ,65 ,8 ,89 ])
42
+ filter_type ([4 ,34 ,22 ,68 ,9 ,13 ,3 ,5 ,7 ,9 ,2 ,12 ,45 ,923 ])
43
+ filter_type ([])
44
+ filter_type (['name' ,'address' ,'phone number' ,'social security number' ])
0 commit comments