Python important questions Unit 1&2
Python important questions Unit 1&2
Short Questions:
Long Questions:
1. What are the data types available in Python? Explain each one with example?
2. What is control statement. Explain with syntax and one example of each.
3. How can you format the output to display strings, integer values and float values. Explain each
with an example?
4. Explain break and continue with suitable example?
5. Write a program that accepts the length of three sides of a triangle as inputs. The program out
should indicate whether or not the triangle is an equilateral triangle.
6. What is recursive function? Write a recursive function to print the Fibonacci series.
7. Write any five differences between list and tuples. Write two examples of list and tuple.
8. Explain about functions? Types of arguments and illustrate with examples?
9. Write a program which reads a sentence and print each word of string in capital letter(Upper
Case)
10. What are control statements. Explain the syntax and one example for each.
11. Explain about list. Write a program to add, remove elements into list and finally delete the list.
12. Explain about if, if-else and nested if statements with proper syntax and example?
13. Define function? What are built-in functions and user defined functions with examples?
14. Write a program to test whether a number is divided by “5 and 10” or by “5 or 10”?
15. Write a program that prompts a user to enter two different numbers. Perform arithmetic
operations based on choices.
16. Explain about for loop with syntax and the use of range function in detail with example?
17. Write a program to calculate the sum of numbers from 1 to 30 which are not divisible by 2, 3 or
5.
18. What are files in python and explain the functions for opening, reading, writing and appending
the files.
19. Define a string in python and explain how to access characters and substrings from a given string
with an example program.
20. Write a program to print the following format
* * * *
* *
* *
* * * *
*****
****
***
**
* * * *
* * * * *
23. Explain about string and its built in function each with an example?