0% found this document useful (0 votes)
7 views2 pages

python code gr7

Python code

Uploaded by

Gee Bee
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)
7 views2 pages

python code gr7

Python code

Uploaded by

Gee Bee
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
You are on page 1/ 2

PYTHON Programming

Pg 67 Lab Session

1) write a python code using then string replication operator,print you name ten times.
# Type your name
name = 'Arun'
print(name * 10)

3) Write a python code input the name, age and basic salary of an employee. calculate the
total salary of an employee by adding 10% DA and 10% HRA to the basic salary.
# Input employee details
name = input("Enter the name of the employee: ")
age = input("Enter the age of the employee: ")
basic_salary = float(input("Enter the basic salary of the employee: ")
# 10% DA
da = 0.10 * basic_salary
# 10% HRA
hra = 0.10 * basic_salary
total_salary = basic_salary + da + hra
print("Employee Name: ",name)
print("Employee Age: ",age)
print(f"Basic Salary:", basic_salary)
print("Total Salary (Including 10% DA and 10% HRA):", total_salary)

4) write a python code to find if a year is a leap year or not


year = int(input("Enter a year: "))
if(year % 4 == 0 ):
print("year is a leap year.",year)
else:
print("year is not a leap year.",year)
5) write a python code to display “valid voter” if the following condition is true: Age of the
person should be >=18
# Get the age input from the user
age = int(input("Enter your age: "))
# Check if the age is greater than or equal to 18
if age >= 18:
print("valid voter") else: print("not a valid voter")

You might also like