Python and HTML Practical Assignments
Name: Hirdesh Bhatt
Class: 9 D
Submission Date: 2082/11/16
Declaration
I hereby declare that the work presented in this project entitled “Python and HTML Practical
Assignments” is my own original effort. All sources and references used during the preparation of this
project are duly acknowledged. This project has not been submitted elsewhere for any other
examination or degree.
Acknowledgement
I would like to express my gratitude to my Computer Teacher for guidance and support throughout this
project. I also thank my classmates and family for their encouragement and assistance. Their help and
feedback were invaluable in completing this work.
Abstract
This project presents a series of practical assignments combining HTML and Python programming tasks
suitable for class 9 students. The assignments include creating simple HTML webpages and writing
basic Python programs, reinforcing coding concepts through hands-on practice. The goal is to help
students understand the syntax and structure of both languages while developing problem-solving
skills. Key topics covered include web page layout, hyperlinks, tables in HTML, and programming
concepts such as input/output, conditional logic, loops, functions, and lists in Python. This document
provides templates and examples for ten assignments, guiding students to practice these skills.
Table of Contents
• Declaration
• Acknowledgement
• Abstract
• Introduction
• Objectives
• Assignment 1: Basic HTML Page Design
• Assignment 2: HTML with Image and Link
• Assignment 3: HTML Table and List
• Assignment 4: Python Hello World Program
• Assignment 5: Python Arithmetic Operations
• Assignment 6: Python Conditional Statement
• Assignment 7: Python Looping Example
• Assignment 8: Python Function Definition
• Assignment 9: Working with Lists in Python
1
• Assignment 10: Python Number Guessing Game
• Conclusion
• References
• Thank You
Introduction
The image above shows a modern multi-monitor coding workspace, illustrating a typical environment
where students might write and test both HTML and Python code. It emphasizes the practical, hands-on
nature of the assignments. In this project, we demonstrate example code that students would create in
such settings. HTML (HyperText Markup Language) is the fundamental building block of the web,
defining the structure and content of web pages 1 , while Python is a high-level, general-purpose
language that emphasizes readability and simplicity 2 . Both languages are widely used and often
introduced to students as key technologies for web development and programming.
Objectives
• Understand the structure of a web page using HTML, which is fundamental for creating websites
1 .
• Learn basic programming in Python, focusing on its readable syntax and problem-solving
approach 2 3 .
• Develop logical thinking by solving practical coding tasks, as learning HTML and Python fosters
creativity and problem-solving skills 4 3 .
• Foster creativity by enabling students to design their own web pages and programs 4 .
• Build a foundation in essential technologies that will prepare students for future learning and
real-world applications 5 6 .
2
Assignment 1: Basic HTML Page Design
The above code snippet shows a simple HTML document structure, including a head and a body section.
For this assignment, students will create an HTML file that displays a main heading and a paragraph.
Make sure to include the basic tags such as <html> , <head> , <title> , <body> , <h1> , and
<p> . Test your page by opening it in a web browser to verify the layout and content.
• Goal: Build a basic HTML web page with a header and paragraph.
• Instructions: Use the provided HTML skeleton and replace the placeholder text with your own
content.
• Expected Outcome: When opened in a browser, the page should show the heading and
paragraph as defined in your HTML code.
Assignment 2: HTML with Image and Link
In this assignment, students will enhance their HTML page by adding an image and a hyperlink. Use the
<img> tag to insert an image (with a valid src attribute) and the <a> tag with an href attribute
to create a clickable link. Ensure that any image file is saved in the project folder and that the link URL is
correct. Finally, open the page in a web browser to verify that the image displays properly and that
clicking the link navigates to the intended page.
• Goal: Add an image and a hyperlink to a web page.
• Instructions: Use <img> to embed an image file and <a href> to create the link. Include
meaningful alt text for the image.
• Expected Outcome: The browser displays the image on the page, and the hyperlink is clickable
and directs to the specified address.
Assignment 3: HTML Table and List
Students will create an HTML page containing a table of data and a list of items. Use the <table> ,
<tr> , and <td> tags to build a simple table, and the <ul> or <ol> tags to create an unordered
or ordered list. Include at least two rows of data in the table and at least three items in the list. After
3
writing the code, open the page in a web browser to ensure the table and list are displayed and
formatted correctly.
• Goal: Create a table and a list in an HTML page.
• Instructions: Use <table> tags for the table, including table rows ( <tr> ) and cells ( <td> ).
Use <ul> (unordered) or <ol> (ordered) for the list.
• Expected Outcome: The web page shows the table with its data and the list of items as intended
when viewed in a browser.
Assignment 4: Python Hello World Program
The example image above shows a fragment of Python code. In this assignment, students will write a
Python program that prints a greeting message to the screen (for example, "Hello, World!"). They
should use the print() function to display text output. Run the program in a Python environment or
online compiler to verify that the message appears correctly.
• Goal: Print a greeting message (e.g., "Hello, World!") using Python.
• Instructions: Write a Python script with print("Hello, World!") . Replace the message
with your name or a greeting.
• Expected Outcome: The console or output window displays the greeting message when the
program is run.
Assignment 5: Python Arithmetic Operations
Students will create a Python program to perform basic arithmetic calculations. For example, write a
program to compute the area of a rectangle using user-provided length and width. The program should
use input() to receive numbers and print() to display the results. After coding, run the program
to ensure it computes correctly for different inputs.
• Goal: Calculate and display the result of basic arithmetic (e.g., area of a rectangle).
• Instructions: Prompt the user for input values (such as length and width) using input() ,
convert them to numbers, perform the calculation, and print the result.
4
• Expected Outcome: The program correctly calculates and prints the arithmetic result (for
example, the area based on the entered values).
Assignment 6: Python Conditional Statement
In this assignment, students will practice decision-making in Python using conditional statements. Write
a program that checks if a number entered by the user is even or odd. Use the if statement and the
modulo operator % to determine the result. Test the program with various inputs to verify that both
cases (even and odd) work correctly.
• Goal: Determine and display whether a user-entered number is even or odd.
• Instructions: Use input() to get a number, then use if with % 2 to check evenness, and
print an appropriate message.
• Expected Outcome: The program outputs "Even number" if the input is even, or "Odd number"
if the input is odd.
Assignment 7: Python Looping Example
Students will practice loops by writing a Python program that prints a sequence of numbers. For
instance, create a program that prints numbers from 1 to 10 using a for loop. Alternatively, use a
while loop to achieve the same result. Emphasize the importance of the loop structure and ensure
the program prints the correct sequence of numbers when run.
• Goal: Print a range of numbers using a loop.
• Instructions: Use a for loop (e.g., for i in range(1, 11): ) or a while loop to print
numbers sequentially.
• Expected Outcome: The console displays the numbers from 1 to 10, one per line, as a result of
the loop.
Assignment 8: Python Function Definition
In this assignment, students will learn about functions in Python. They should write a function that
takes two numbers as arguments and returns their sum. Then call this function in the main program by
passing example values and print the returned result. This exercise illustrates how to define reusable
code blocks; test the function to ensure it works with different inputs.
• Goal: Create and use a simple function that adds two numbers.
• Instructions: Define a function (e.g., def add(a, b): ) that returns the sum of its
parameters. Call the function with two example values and print the result.
• Expected Outcome: The program correctly prints the sum of the two numbers provided to the
function.
Assignment 9: Working with Lists in Python
Students will work with lists by creating a Python program that processes a list of items. For example,
define a list of at least five numbers and use a loop to print each number. Then compute and print the
sum of all numbers in the list. This task helps practice list manipulation and iteration; ensure the
program outputs each list element and the total sum correctly.
• Goal: Iterate through a list and perform calculations (e.g., sum the items).
5
• Instructions: Create a Python list (e.g., numbers = [1, 2, 3, 4, 5] ), use a loop to print
each element, and then calculate the sum of the list elements and print it.
• Expected Outcome: Each number in the list is printed on a separate line, followed by the correct
total sum of the list items.
Assignment 10: Python Number Guessing Game
For a final challenge, students can create a simple number guessing game in Python. The program
should randomly select a number between 1 and 20, then repeatedly prompt the user to guess it. Use a
while loop and if statements to give feedback ("Too high" or "Too low") until the correct number is
guessed, then print a congratulatory message. This assignment integrates loops, conditions, and user
input into one small project.
• Goal: Implement a number guessing game with user interaction.
• Instructions: Use the random module to pick a number, then use a while loop to allow
repeated guesses. Inside the loop, compare the user's guess to the target and print hints. Exit
the loop when the guess is correct.
• Expected Outcome: The game continues prompting the user until the correct number is
guessed, and then it congratulates the user.
Conclusion
In conclusion, this project has guided students through creating web pages with HTML and writing
Python programs, reinforcing their understanding of programming fundamentals. The hands-on
assignments were designed to be interactive and practical, enabling students to see the results of their
code immediately. By completing these exercises, students not only learned technical syntax but also
built problem-solving and creative skills—benefits highlighted by educational resources 4 3 . Such
practical learning lays a strong foundation for future studies and real-world applications of coding and
web development.
References
• MDN Web Docs, "HTML: HyperText Markup Language" 1 .
• Wikipedia, "Python (programming language)" 2 .
• Skill Struck, "5 Reasons Why It’s Important for K-12 Students to Learn HTML" 4 .
• LocoRobo, "Why Python Is the Best Language for Middle and High School CS" 3 6 .
Thank You
I am grateful to my teacher for guiding me and to my friends and family for their encouragement.
Thank you for reviewing this project and for your support.
1 HTML: HyperText Markup Language | MDN
[Link]
2 Python (programming language) - Wikipedia
[Link]
3 6 Why Python Is the Best Language for Middle and High School CS - LocoRobo
[Link]
6
4 5 5 Reasons Why It’s Important for K-12 Students to Learn HTML - Skill Struck - Blog
[Link]