Python Programming Questions
1. Distinguish between if-else, if-elif-else, for, and while control statements with illustrative code
snippets.
2. Write a Python program to convert temperature from Celsius to Fahrenheit. (Hint: C = (F - 32) * 5
/ 9)
3. Write a program to print 'Welcome to SIT' exactly five times:
i) using for loop
ii) using while loop
4. Write a program to add n numbers accepted from the user and print the result.
5. Differentiate between different standard data types and Type conversion functions used in Python
programming language with example.
6. Write a program to guess the number by taking input from keyboard and also to print the number
of guesses taken to guess the correct answer. Write the output of the program for sample inputs.
7. With definition of local and global variables, demonstrate the scope of local and global variables
with example codes for all possible scenarios.
8. Write a Magic 8 ball program using user-defined function, if statement, and randint function of
random module. Write the output of the program for sample input.
9. Define lists with illustrative examples and justify the following with examples over the list:
i) Indexing
ii) Slicing
iii) random.choice() and random.shuffle()
iv) append() and remove()
v) sort()
10. a) Illustrate the usage of str(), int() and float() functions with suitable examples.
b) Write a program to read the name and age of a person. Display whether the person is a senior
citizen or not using if and elif statements.
c) Differentiate between local and global variables. Give suitable examples.
OR
11. a) Summarize the differences between break and continue statements.
b) How the for loop along with range function works in Python? Illustrate with an example
program.
c) What is exception handling? Write a Python program to handle zero division error.