WISCONSIN INTERNATIONAL UNIVERSITY COLLEGE
MSC Cyber Security and Digital Forensics – Sept – Dec 2025
120 Hands on Practical Python Questions
A. String Concatenation (1–10)
1. Concatenate "Hello" and "World" with a space between.
2. Concatenate "Python" and "3.10" without space.
3. Concatenate "Open" and "AI" three times each.
4. Concatenate a number 5 with a string "Stars" (convert correctly).
5. Join a list of strings ["I", "love", "Python"] into a sentence.
6. Concatenate "Good" and "Morning" using f-string.
7. Concatenate "Data" and "Science" using format().
8. Concatenate user input first name and last name with a space.
9. Concatenate "abc" and "123" and print its length.
10. Concatenate "Apple", "Banana", "Cherry" separated by commas.
B. expandtabs() (11–20)
11. Use expandtabs(4) on "Name\tAge\tCity".
12. Use expandtabs(10) on "ID\tScore\tGrade".
13. Compare the output of expandtabs(2) and expandtabs(8) on "A\tB\tC".
14. Create a table-like output with expandtabs().
15. Apply expandtabs(5) on a string with multiple tabs.
16. Count spaces after using expandtabs(6) on "X\tY".
17. Use expandtabs(12) on "Python\tProgramming".
18. Print "1\t2\t3" using different tab sizes (4, 8, 16).
19. Format student records with expandtabs().
20. Use expandtabs() on a multi-line string.
C. String Slicing (21–40)
21. Slice "Python" to get "Pyt".
22. Slice "Python" to get "on".
23. Slice "HelloWorld" to get "World".
24. Get every second character from "abcdef".
25. Reverse the string "Programming".
26. Slice "DataScience" to get "Data".
27. Slice "DataScience" to get "Science".
28. Get the first character of "Python".
29. Get the last character of "Python".
30. Slice "abcdefg" to get "bcd".
31. Slice "abcdefg" to get "aceg".
32. Get substring "thon" from "Python".
33. Slice "developer" to get "vel".
34. Slice "developer" to get "per".
35. Slice "machinelearning" to get "learning".
36. Slice "abcdefghij" to get "defgh".
37. Slice "abcdefghij" with step 2.
38. Slice "abcdefghij" with step 3.
39. Use negative slicing on "abcdefghij".
40. Get last 5 characters of "ProgrammingLanguage".
D. Data Types & Variables (41–60)
41. Assign integer 10 to a variable and print its type.
42. Assign float 15.5 to a variable and print its type.
43. Assign string "Python" to a variable and print its type.
44. Assign a boolean value and check its type.
45. Assign a list [1, 2, 3] to a variable and print its type.
46. Assign a tuple (1, 2, 3) to a variable.
47. Assign a dictionary {"a":1, "b":2} to a variable.
48. Assign a set {1, 2, 3} to a variable.
49. Convert integer 25 into string.
50. Convert string "45" into integer.
51. Convert float 3.14 into integer.
52. Convert integer 100 into float.
53. Assign multiple values x, y, z = 1, 2, 3.
54. Swap two variables without using a third variable.
55. Check the type of "123" using type().
56. Check if "123" is digit using isdigit().
57. Convert string "100.55" into float.
58. Convert string "True" into boolean.
59. Check if variable x = None is NoneType.
60. Print all Python standard data types.
E. String Methods (61–80)
61. Convert "hello world" into uppercase.
62. Convert "HELLO WORLD" into lowercase.
63. Capitalize the first letter of "python programming".
64. Title-case "python programming language".
65. Count how many times "a" appears in "banana".
66. Find the position of "n" in "banana".
67. Replace "Java" with "Python" in "I love Java".
68. Check if "apple" starts with "a".
69. Check if "banana" ends with "a".
70. Remove spaces from " Python ".
71. Remove commas from "1,000,000".
72. Split "Python is fun" into a list.
73. Join ["Python", "is", "fun"] into one string.
74. Check if "1234" is numeric.
75. Check if "Python3" is alphanumeric.
76. Convert "PYTHON" into lowercase and compare with "python".
77. Replace all spaces in "Python is awesome" with underscores.
78. Reverse a string using slicing and method.
79. Check if a string is palindrome.
80. Use zfill() to pad "45" into 5 digits.
F. f-strings & format() (81–100)
81. Print "Hello John" using f-string with name = "John".
82. Print "2 + 3 = 5" using f-string.
83. Print "Area = 50" using f-string with variables length=10, width=5.
84. Format float 3.14159 to 2 decimal places using f-string.
85. Print "Hello Alice, you are 25 years old" using f-string.
86. Use f-string to align text "Python" to 10 spaces.
87. Print binary representation of 10 using f-string.
88. Print hexadecimal representation of 255 using f-string.
89. Use format() to print "My name is Bob" with variable.
90. Use format() to print "I have 2 apples".
91. Use format() to print two decimal places of 3.4567.
92. Format string "Python" in 20 spaces using format().
93. Format number 123 with leading zeros (width 6).
94. Format 255 into binary using format().
95. Format 255 into hexadecimal using format().
96. Print "The price is 50.75 USD" using format().
97. Format multiple variables x=5, y=10 into a string.
98. Print "John scored 95 in Math" using format().
99. Use format() to right align "Python" in 15 spaces.
100. Use format() to center "Python" in 20 spaces.
G. f-strings & format() (100–120)
101. Assign the value 10 to a variable x and print it.
102. Assign multiple values x=5, y=10, z=15 in one line and print them.
103. Swap two variables a=7, b=3 without using a third variable.
104. Assign a string "Python" to a variable and print its type.
105. Assign the same value 100 to three variables a, b, c in one line.
106. Change the value of a variable x=10 to x=20 and print both values.
107. Delete a variable using del and try printing it.
108. Use variables to store radius and calculate the area of a circle.
109. Assign a boolean value True to a variable and check its type.
110. Assign a list [1, 2, 3] to a variable and print it.
111. Assign a tuple (4, 5, 6) to a variable and print it.
112. Assign a dictionary {"name": "Alice", "age": 25} to a variable and print the value
of "age".
113. Assign a set {1, 2, 3, 4} to a variable and check if 3 exists in it.
114. Use id() to print the memory address of a variable.
115. Use type() to check the type of 3.14.
116. Assign a variable inside a function and test if it’s accessible outside.
117. Declare a global variable and access it inside a function.
118. Use shorthand assignment x += 5 when x=10.
119. Assign a variable with None and check its type.
120. Assign a variable name in uppercase (e.g., PI = 3.14159) to represent a constant.