0% found this document useful (0 votes)
4 views15 pages

Python Programs for Beginners

The document is a practical file for Informatics Practices by Bhavya Goyal, detailing various Python programs including a welcome message generator, age calculator, area of a rectangle, simple calculator, currency converter, student bio-data, favourite things list, math expressions evaluator, string formatter, and data type identifier. Each program includes a problem statement, Python code, and sample input and output. The practical file is intended for the academic year 2025-26 at New Era Public School.

Uploaded by

ritu99189
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views15 pages

Python Programs for Beginners

The document is a practical file for Informatics Practices by Bhavya Goyal, detailing various Python programs including a welcome message generator, age calculator, area of a rectangle, simple calculator, currency converter, student bio-data, favourite things list, math expressions evaluator, string formatter, and data type identifier. Each program includes a problem statement, Python code, and sample input and output. The practical file is intended for the academic year 2025-26 at New Era Public School.

Uploaded by

ritu99189
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Informatics Practices Practical File

Name: Bhavya Goyal


Class: XI-C
Roll Number: 08
Subject: Informatics Practices
School Name: New Era Public School
Academic Year: 2025-26
Program 1: WELCOME MESSAGE GENERATOR
Problem Statement
Ask the user for their name and print a customized welcome message.
Python Code
# Program 1: Welcome Message Generator
name = input("Enter your name: ")
print("Hello,", name + "! Welcome to Python programming.")
Sample Input & Output
Input: Bhavya
Output: Hello, Bhavya! Welcome to Python programming.
Screenshot
Program 2: AGE CALCULATOR
Problem Statement
Take the user’s birth year and current year as input, and display their age.
Python Code
# Program 2: Age Calculator
birth_year = int(input("Enter your birth year: "))
current_year = int(input("Enter the current year: "))
age = current_year - birth_year
print("Your age is:", age)
Sample Input & Output
Input: 2008, 2025
Output: Your age is: 17
Screenshot
Program 3: AREA OF A RECTANGLE
Problem Statement
Ask the user for the length and breadth and print the area.
Python Code
# Program 3: Area of a Rectangle
length = float(input("Enter the length of the rectangle: "))
breadth = float(input("Enter the breadth of the rectangle: "))
area = length * breadth
print("Area of the rectangle is:", area)
Sample Input & Output
Input: 8,5
Output: Area of the rectangle is: 40.0
Screenshot
Program 4: SIMPLE CALCULATOR

Problem Statement:
Input two numbers and print their sum, difference, product, and quotient.
Python Code:
# Program 4: Simple Calculator
num1 = float(input("Enter first number: "))
num2 = float(input("Enter second number: "))
print("Sum:", num1 + num2)
print("Difference:", num1 - num2)
print("Product:", num1 * num2)
print("Quotient:", num1 / num2)
Sample Input & Output:
Input: 20,4
Output: Sum: 24.0
Difference: 16.0
Product: 80.0
Quotient: 5.0
Screenshot:
Program 5: CURRENCY CONVERTER
Problem Statement:
Convert Indian Rupees into US Dollars (₹1 = $0.012).
Python Code:
# Program 5: Currency Converter
inr = float(input("Enter amount in Indian Rupees: "))
usd = inr * 0.012
print("Equivalent in US Dollars: $", usd)
Sample Input & Output:
Input: 1000
Output: Equivalent amount in US Dollars is: 12.0
Screenshot:
Program 6: STUDENT BIO-DATA
Problem Statement:
Take student's name, age, class, and school name and display formatted bio-data.
Python Code:
# Program 6: Student Bio-Data
name = input("Enter your name: ")
age = input("Enter your age: ")
student_class = input("Enter your class: ")
school = input("Enter your school name: ")
print("\n--- Student Bio-Data ---")
print("Name:", name)
print("Age:", age)
print("Class:", student_class)
print("School:", school)
Sample Input & Output:
Input: Bhavya, 17, 11, New Era Public School
Output: --- Student Bio-Data ---
Name: Bhavya
Age: 17
Class: 11
School: New Era Public School
Screenshot:
Program 7: FAVOURITE THINGS LIST
Problem Statement:
Take 3 favourite books/songs/games from user and print the list and its type.

Python Code:
# Program 7: Favourite Things List
fav1 = input("Enter your 1st favourite thing: ")
fav2 = input("Enter your 2nd favourite thing: ")
fav3 = input("Enter your 3rd favourite thing: ")
favourites = [fav1, fav2, fav3]
print("Your Favourite Things:", favourites)
print("Data Type:", type(favourites))

Sample Input & Output:


Input: Believe in Yourself, Shri Krishna Govind Hare Murari, Among us
Output: Your favourite things are: [‘Believe in Yourself’, ‘Shri Krishna Govind Hare murari’, 'Among us']
Data type of the list is: <class 'list'>

Screenshot:
Program 8: MATH EXPRESSIONS EVALUATER
Problem Statement:
Take 2 numbers and print values of math expressions.

Python Code:
# Program 8: Math Expressions Evaluator
a = float(input("Enter first number: "))
b = float(input("Enter second number: "))
print("(a + b) * 2 =", (a + b) * 2)
print("a ** b =", a ** b)
print("(a + b) / 2 =", (a + b) / 2)

Sample Input & Output:


Input: a = 5, b = 3
Output: (a + b) * 2 = 16.0
a raised to power b (a ** b) = 125.0
Average of a and b= 4.0

Screenshot:
Program 9: STRING FORMATTER
Problem Statement:
Take name and favourite color and print a formatted sentence.
Python Code:
# Program 9: String Formatter
name = input("Enter your name: ")
color = input("Enter your favourite color: ")
print("My name is", name, "and I love the color", color + ".")
Sample Input & Output:
Input: Bhavya, Black
Output: My name is Bhavya and I love the color Black.
Screenshot:
Program 10: DATA TYPE IDENTIFIER
Problem Statement:
Take one integer, one float, one string and print each with its data type.
Python Code:
# Program 10: Data Type Identifier
num1 = int(input("Enter an integer: "))
num2 = float(input("Enter a float: "))
text = input("Enter a string: ")
print("Value:", num1, "| Type:", type(num1))
print("Value:", num2, "| Type:", type(num2))
print("Value:", text, "| Type:", type(text))
Sample Input & Output:
Input: 11, 3.14, Python
Output: Integer value: 11 Type: <class 'int'>
Float value: 3.14 Type: <class 'float'>
String value: Python Type: <class 'str'>
Screenshot:

You might also like