Practice Set 2
Course Code: CSG4.51005
Course Name: Basic Python Programming
1 Define Python. List four features of Python.
2 Explain the importance of indentation in Python.
3 Write a Python program to display 'Hello Python'.
4 Differentiate between compiled and interpreted languages.
5 Explain the process of installing Python and IDLE.
6 List and explain basic Python data types.
7 Write a Python program to input name and age and display them.
8 Explain the use of comments in Python with examples.
9 Write a program to swap two variables.
10 Differentiate between input() and print() functions.
11 Explain dynamic typing in Python.
12 Write a program to convert Celsius to Fahrenheit.
13 Describe Python tokens with examples.
14 Explain variables and naming conventions in Python.
15 Write a program to calculate the area of a circle.
16 Explain difference between integer and float.
17 Write a program to find square of a number.
18 Explain code documentation in Python.
19 Write a program to calculate average of three numbers.
20 Analyze how Python differs from C.
21 List different types of operators in Python.
22 Explain arithmetic operators with examples.
23 Program to check if a number is positive or negative.
24 Explain relational operators with examples.
25 Program to find largest of three numbers.
26 Explain logical operators with examples.
27 Program to print numbers 1 to 10 using for loop.
28 Explain syntax of if-elif-else.
29 Program to check divisibility by 5.
Practice Set 2
Course Code: CSG4.51005
Course Name: Basic Python Programming
30 Explain while loop with example.
31 Program to calculate factorial using loop.
32 Explain nested loops.
33 Program to print pattern using loops.
34 Explain break statement.
35 Program demonstrating continue.
36 Explain pass statement.
37 Program using range() to print even numbers.
38 Differentiate for and while loops.
39 Program to sum numbers from 1 to N.
40 Analyze output of given loop program.
41 Define string in Python.
42 Explain string slicing with examples.
43 Program to reverse a string.
44 Explain lists with examples.
45 Program to find largest number in a list.
46 Differentiate lists and tuples.
47 Program to count vowels in string.
48 Explain dictionary data structure.
49 Program to create student dictionary.
50 Explain set data structure.
51 Program to remove duplicates using set.
52 Explain indexing in lists.
53 Program to find length of string.
54 Explain iteration over lists.
55 Program to merge two lists.
56 Explain tuple packing and unpacking.
57 Program to sort list elements.
58 Explain dictionary keys and values.
59 Program to count occurrences in list.
Practice Set 2
Course Code: CSG4.51005
Course Name: Basic Python Programming
60 Analyze differences between list, tuple, set, dictionary.
61 Define function in Python.
62 Explain syntax of defining function.
63 Function to find square of number.
64 Explain types of function arguments.
65 Function to calculate factorial.
66 Explain recursion with example.
67 Recursive Fibonacci function.
68 Explain variable scope.
69 Program using lambda function.
70 Explain built-in functions.
71 Function to check prime number.
72 Explain modules in Python.
73 Program importing math module.
74 Explain advantages of modular programming.
75 Program using random module.
76 Explain Python packages.
77 Steps to install package using pip.
78 Function to find maximum of two numbers.
79 Explain default arguments with example.
80 Analyze differences between functions and modules.
81 Define file handling in Python.
82 Explain file modes r, w, a.
83 Program to write data to text file.
84 Program to read data from file.
85 Explain binary files.
86 Program to append data to file.
87 Explain with statement in file handling.
88 Program to count lines in file.
89 Explain exception handling.
Practice Set 2
Course Code: CSG4.51005
Course Name: Basic Python Programming
90 Program demonstrating try-except.
91 Explain the finally block.
92 Program to handle division by zero.
93 Explain multiple exceptions.
94 Program to handle file not found exception.
95 Explain custom exceptions.
96 Program raising exception manually.
97 Explain advantages of exception handling.
98 Program to read file line by line.
99 Explain syntax vs runtime error.
100 Analyze how exception handling improves reliability.