Python Module 1
Python Module 1
Python Module 1
Conditional statement
Question-1
You are tasked with writing a Python program to identify an employee whose
projected income falls between 10 LPA and 12 LPA (both values inclusive).
Below is a guide to assist you in writing the code:
else:
if (Language=="Python" or Language=="Java"):
else:
else:
else:
else:
if(IDCard==True):
else:
print("Access Denied!!")
CONDITIONAL LADDER
Question-1
You're presented with a task to determine the bonus percentage for
employees based on their performance grade.
if(Grade=="A" or Grade=="a"):
elif(Grade=="B" or Grade=="b"):
elif(Grade=="C" or Grade=="c"):
print("You will receive bonus of 75%")
elif(Grade=="D" or Grade=="d"):
elif(Grade=="E" or Grade=="e"):
else:
print("Invalid input")
Question-2
Use the following conditions to determine the tier and the corresponding
benefit message:
1. If the experience is between 0 and 2 (inclusive), print "You will
receive Tier 1 Benefits :)".
2. If the experience is between 3 and 5 (inclusive), print "You will
receiveTier 2 Benefits :)".
3. If the experience is between 6 and 8 (inclusive), print "You will
receive Tier 3 Benefits :)".
4. If the experience is 9 or more, print "You will receive Tier 4
Benefits".
5. For any other input, print "Invalid Input".
if(Experience >=0 and Experience <=2):
print("You will receive Tier 1 Benefits :)")
elif(Experience >=3 and Experience <=5):
print("You will receiveTier 2 Benefits :)")
elif(Experience >=6 and Experience <=8):
print("You will receive Tier 3 Benefits :)")
elif(Experience >= 9):
print("You will receive Tier 4 Benefits")
else:
print("Invalid Input")
LOOP
Question-1
Your task is to create a Python program that takes the salaries of three
new employees and adds these costs to the existing expense amount of
102000. The program should then display the final expense total.
num_employees = 3
total_expenses = 102000
total_expenses +=salary
print("The total salary expenses for ",num_employees," employees is: ", total_expenses)
Question-2
In your role as the HR manager, you are responsible for evaluating
employee ratings and deciding appropriate actions based on their
performance. You have received employee rating data in the form of a
matrix. You need to create a program that checks each employee's rating
and determines the next steps accordingly.
for i in range(1,N+1):
else:
LOOP+CONDITION
Question-1
As the corporate landscape continues to evolve, technological advancements
have led to the dominance of machines and automation. In light of this,
your company requires an attendance system to efficiently manage employee
presence. Your task involves creating a temporary attendance system that
can accurately track employee attendance, and provide insights such as the
total attendance count, the number of employees on holiday, and the number
of absent employees.
N=3
Pcount = 0
Hcount = 0
for i in range(N):
attendance = attendance_data[i]
if attendance == "P":
Pcount += 1
Hcount += 1
print("Total employees:", N)
N=2
employee_data = [
for i in range(N):
employee = employee_data[i]
name = employee["name"]
TLrating = employee["TL_rating"]
Mrating = employee["Manager_rating"]
CEOrating = employee["CEO_rating"]
print(name,"Your Rating:",Frating)
else:
print("Invalid Input")
for i in range(rows):
stars = "*" * (2 * i + 1)
print(spaces + stars)
Question-2
Write a code to implement the logic and print the following pattern given
stars = "*" * (2 * i + 1)
print(spaces + stars)
Question -3
Write a code to implement the logic and print the following pattern given
below .
for i in range(rows):
stars = "*" * (2 * i + 1)
print(spaces + stars)
stars = "*" * (2 * i + 1)
print(spaces + stars)
Question-4
Write a Python program that checks a student's grade based on their
percentage according to the given criteria table:
print("O")
print("A")
print("B")
print("C")
print("D")
else: