Home Task Assignment – Computer Science
Class: 70th Entry (10th Class)
Subject: Computer Science Submission Deadline: [In Class, Soon after the Summer Break]
Topic: Python Programming Mode of Submission: [Hard copy document printed on A4 Pages]
Instructions:
Write the Python Programs along with their successfully compiled, clear screenshots of both code and outputs.
Don’t Use the ChatGpt and any other AI tool to generate the code, try to write it by yourself. Your Home Task exam
will be viva from your Home Task Assignment and will cover all the Python topics that we learned in 9th Class until
the Conditional statements and were a part of your promotional exams.
Programs to Write:
1. Write a Python program that declares the following variables:
Your full name (string)
Your age (int)
Your CGPA (float)
Whether you're a boarder (boolean)
Use the type() function to print the datatype of each variable.
2. Take input from the user for their first name and last name, and then:
Concatenate them into one full name.
Capitalize the full name.
Display a welcome message like:
Welcome, Firstname Lastname!
3. Write a program that asks the user for a sentence. Then:
Replace all spaces with underscores.
Count how many times the word “Python” appears.
Check if the sentence ends with a period (use endswith()).
4. Ask the user for their percentage marks. Write a program that prints the grade based on the following criteria:
90 and above → A+
80–89 → A
70–79 → B
60–69 → C
Below 60 → Fail
Make use of if, elif, and else.
5. Take a string input from the user. Then:
Print the first and last characters using indexing.
Print the first half and second half of the string using slicing.
Reverse the string using slicing.
6. Write a program that:
Takes two numbers from the user.
Calculates and prints their sum, difference, product, quotient, and average.
Also print which number is greater using conditional statements.
7. Write a complete program that:
Calculates the area of a circle using a given radius (input by the user).
Add proper single-line and multi-line comments to explain each part of your code.
8. Create a program that checks if a student is eligible for a scholarship.
Conditions:
Marks must be above 85
Must be a boarder student
Ask the user to input their marks and whether they are a boarder (True/False), then decide.
9. Take a string input from the user. Then apply and print the result of the following functions on it:
.capitalize()
.replace('a', '@')
.find('the')
.count('e')
10. Write a program that:
Stores a username and password in variables.
Takes input from the user to "login".
Compares the input values to the stored credentials.
Prints “Login successful!” if both match, otherwise prints “Invalid username or password.”
11. Write a Python program to check if a user-entered word is a palindrome (a word that reads the same
backward, like 'madam' or 'racecar'). Use slicing and conditional statements.
12. Ask the user to input a password. Check and print whether the password is Strong, Medium, or Weak using the
following criteria:
Strong: At least 8 characters, includes numbers and special characters
Medium: At least 6 characters, includes either numbers or special characters
Weak: Anything else
13. Ask the user to enter a sentence and a word. Count how many times the word appears in the sentence using
the .count() method. The search should be case-insensitive.
14. Create a calculator that:
Asks the user for two numbers
Shows a menu: 1) Add 2) Subtract 3) Multiply 4) Divide
Performs the selected operation and shows the result
Use if-elif-else and handle invalid options.
15. Ask the user to input marks for 5 subjects. Then:
Calculate total and percentage
Assign a grade based on the percentage
Print “Pass” or “Fail” based on whether the student has scored more than 40% in each subject
16. Take three numbers as input and write a program that finds and prints the largest one using nested if-else
conditions.
17. Write a program to input a sentence and replace all vowels with a * symbol.
18. Ask the user to input a number. Find and print the sum of its digits. Example:
Input = 1234 → Output = 1+2+3+4 = 10.
19. Write a Python program that takes a sentence and prints the sentence with words in reverse order.
Example: 'Hello World' → 'World Hello'.
20. Ask the user to enter a string. Display how many times each character appears in the string using a loop and
dictionary.