Assignment 01
Question 1: Code Along
Problem: Write a Python program that takes a string as input and prints out the
following:
1. The string in reverse order.
2. The number of vowels in the string.
Instructions:
● Use basic string manipulation techniques such as loops, conditionals, and
string methods.
● Ensure that the program counts both uppercase and lowercase vowels (a, e,
i, o, u).
Example Input:
Enter a string: Hello World
Example Output:
Reversed string: dlroW olleH
Number of vowels: 3
Question 2: Hands-on Coding Project
Problem: Create a Python program that:
● Takes an input number from the user.
● Checks whether the number is even or odd.
● Prints the result.
Instructions:
● Write a Python script that accepts a number from the user, determines
whether it is even or odd, and prints the result.
● Use conditionals to check if the number is even or odd.
Example Input:
Enter a number: 5
Example Output:
The number 5 is Odd.
Question 3: Virtual Environment Application
Problem: Create a Python program that:
1. Takes a list of integers as input.
2. Creates a new virtual environment called sortenv.
3. Installs a package (such as numpy) in the virtual environment.
4. Sorts the list using a numpy method (numpy.sort()).
5. Prints the sorted list.
Instructions:
● You will not be expected to actually run the environment creation commands
but rather simulate what would happen by describing the steps in your code
and then focusing on the sorting operation.
● Make sure that your program explains each step as comments and performs
sorting using numpy.
Example Input:
Enter a list of numbers: [4, 2, 7, 1, 3]
Example Output:
Sorted list: [1, 2, 3, 4, 7]
Grading Criteria (Total: 30 Marks)
Criteria Marks Description
Correctness of 15 The program solves the
Program (Logic) problem correctly by
producing the expected
output.
Code Quality 5 Code is well-structured,
(Readability) follows Pythonic
practices, and includes
meaningful variable
names.
Use of Concepts 5 Proper use of loops,
(Loops, Conditions, conditionals, and virtual
Virtual Environments) environments as
demonstrated in the
code.
Testing & Input 5 The program handles
Handling user inputs correctly and
includes basic validation
for edge cases.