Unit1 2 3 - Assignments
Unit1 2 3 - Assignments
Unit 1 Introduction:
1. How conditional statements are used in Python? What is the importance of indentation in conditional
and iterations?
2. What is the difference between if-else and for-else/while-else? Describe it with example?
3. Write a program to implement if, elif, else in Python?
4. What is the importance of ternary operator? Write a program to find the greatest number among three
numbers.
5. What is the use of “pass” keyword in Python? Why conditionals, loops and functions use pass keyword?
6. What is a range() function? What is the use of it in Python? What is the difference of using three
overloaded range function? [range(n), range(a,b), and range(a,b,s)]
7. What is the difference between for and while loop? Explain with example.
8. Write a program to print the binary form of decimal number using while loop.
9. What is the difference between break and continue statement? Give proper examples.
10. How do-while is used in Python?
11. What is walrus operator in Python? What is the importance of walrus operator, explain with example?
12. Write a program using walrus operator to add the students in a list until we enter the string stop.