... | ... | @@ -6,23 +6,41 @@ |
|
|
* [ ] dynamically typed
|
|
|
* [ ] object-oriented
|
|
|
|
|
|
2. write a function to calculate the sum of first 'n' integers
|
|
|
2. What is the value of `b` at the end of this code execution:
|
|
|
|
|
|
3. Using list comprehension, write a function that displays first 'n' integers divisible by 7
|
|
|
a=2
|
|
|
b=0
|
|
|
if a<0:
|
|
|
b=1
|
|
|
elif a>0 and a<5:
|
|
|
b=2
|
|
|
else:
|
|
|
b=3
|
|
|
|
|
|
4. what is a generator ?
|
|
|
* [ ] 0
|
|
|
* [ ] 1
|
|
|
* [ ] 2
|
|
|
* [ ] 3
|
|
|
|
|
|
5. write a context manager to calculate the clock-wall time taken by a code block
|
|
|
3. What are the first 4 results printed by this code:
|
|
|
|
|
|
6. write a class to represent a shutter, ie. something that can be 'opened' or 'closed'
|
|
|
a, b = 0, 1
|
|
|
while b < 1000:
|
|
|
print b
|
|
|
a, b = b, a+b
|
|
|
|
|
|
7. Tell 3 differences between Python 2 and Python 3
|
|
|
4. Write a function to calculate the sum of first 'n' integers
|
|
|
|
|
|
8. What are the first 4 results printed by this code:
|
|
|
5. Using list comprehension, write a function that displays first 'n' integers divisible by 7
|
|
|
|
|
|
6. What is a generator ?
|
|
|
|
|
|
7. Write a context manager to calculate the clock-wall time taken by a code block
|
|
|
|
|
|
9.
|
|
|
8. Write a class to represent a shutter, ie. something that can be 'opened' or 'closed'
|
|
|
|
|
|
9. Explain briefly the difference between a thread and a coroutine run by a scheduler
|
|
|
|
|
|
10. Tell 3 differences between Python 2 and Python 3
|
|
|
|
|
|
10.
|
|
|
|