Professional Documents
Culture Documents
AI102-Lab 10 Week 11
AI102-Lab 10 Week 11
Lab (10)
Revision Python
Question 1:
What is output of the following examples:
1. Print (14//4, 14%4, 14.0/4)
2. print (2*'No' + 3*'!')
print (2 * ('No' + 3*'!'))
3. print('how\nis it\nnow')
4. for z in [2, 4, 7, 9]:
print(z - 1)
5. def func(x):
return x - 1
print(func(3) * func(5))
6. print(list(range(3)))
Question 2:
Suppose you take a list of words from the user, wordList. Write Python
code that will write one line for each word, repeating that word twice.
For example if wordList is ['Jose', 'Sue', 'Ivan'], then your code would
print
Jose Jose
Sue Sue
Ivan Ivan
Question 3:
Question 4:
Write a python program that contains a function to calculate the factorial
of user input considering the factorial of zero and negative numbers.