selection
repetition
sequence
flow
colon
statements indented at a lower, same level
indentation in any form
{ }
A comment
}
end
A line that is indented less than the previous line
pass
break
continue
goto
[0, 1, 2]
[0, 1, 2, 3]
[1, 2, 3]
[0, 2]
[0, 2, 4]
[1, 3, 5]
[0, 1, 2, 5]
[0, 5, 2]
[10, 8, 6]
[9, 7, 5]
[6, 8, 10]
[5, 7, 9]
[]
[2, 5, 8]
[8, 5, 2]
Numbers
String
List
Slice
int(x [,base])
long(x [,base])
float(x)
str(x)
27
9
3
1
int
bool
void
None
True
False
Machine dependent
Error
What will following code segment print?
a=True b=False c=False if not a or b: print(1) elif not a or not b and c: print(2) elif not a or b or not b and a: print(3) else: print(4)
2
4
How many numbers will be printed by the following code?
def fun(a,b): for x in range(a,b+1): if x%3==0: print(x,end=" ") fun(100,120)
7
8
6
/ /
>
and
?
20
20.0
28
28.0
Int
Float
int or float
None of these