The document outlines various Python programming tasks including variable declaration, basic arithmetic operations, user input handling, control flow with loops, list manipulation, function creation, and class definitions. It also covers concepts such as abstract classes and inheritance in Python. Each section provides specific instructions for writing code to demonstrate these programming concepts.
The document outlines various Python programming tasks including variable declaration, basic arithmetic operations, user input handling, control flow with loops, list manipulation, function creation, and class definitions. It also covers concepts such as abstract classes and inheritance in Python. Each section provides specific instructions for writing code to demonstrate these programming concepts.
Write a Python program that demonstrates the following:
Declare a variable of type int, float, str, and bool.
Print each variable and its type. 2.Write a Python program that performs the following operations:
Add two numbers.
Subtract two numbers. Multiply two numbers. Divide two numbers. Find thearemainder 9.Write (modulus) Python program that:of two numbers. Find the power of a number (e.g., 2^3). Takes input for name and age from the user. Prints a message saying "Hello, [name]! You are [age] years old."
4.Write a Python program that:
Checks if a number is even or odd using an if-else statement.
Uses a for loop to print all numbers from 1 to 10. Uses a while loop to print numbers from 10 to 1.
5.Write a Python program that:
Creates a list with 5 elements.
Accesses and prints the third element of the list. Modifies the second element and prints the updated list.
6.Write a Python function that:
Takes two numbers as arguments.
Returns the sum of the two numbers. 7.Write a Python class Person that:
Has two attributes: name and age.
Has a method greet that prints "Hello, [name]!".
8 Write a Python class Rectangle that:
Has attributes length and width.
Has a method area that returns the area of the rectangle. 9. Interfaces Write a Python abstract class Shape with an abstract method area. Create a class Circle that implements the Shape class and calculates the area of a circle.
10.Inheritance Write a Python program that demonstrates inheritance. Create a Vehicle class with a method move. Create a Car class that inherits from Vehicle and overrides the move method.