This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
task 5.a | |
def find_employee_by_id(employees, target_id): | |
for employee in employees: | |
if employee['id'] == target_id: | |
return employee | |
return None | |
# Test the function | |
employees = [ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
task 5.a | |
def find_employee_by_id(employees, target_id): | |
for employee in employees: | |
if employee['id'] == target_id: | |
return employee | |
return None | |
# Test the function | |
employees = [ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
task 4.a | |
#Add Elements: Add elements to the list. | |
list=[10,20] | |
a=30 | |
list.append(a) | |
print(list) | |
#Remove Elements: Remove specific elements from the list. | |
list.pop(1)#by index value |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
task 3.a | |
# Function to find k'th non repeating character | |
# in string | |
from collections import OrderedDict | |
def kthRepeating(input,k): | |
# OrderedDict returns a dictionary data structure having characters of input | |
# string as keys in the same order they were inserted and 0 as their default value | |
dict=OrderedDict.fromkeys(input,0) | |
# now traverse input string to calculate frequency of each character |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
task 2.a | |
score =int(input("Enter the score:")) | |
if score>=90: | |
print("The Grade is A") | |
elif (score <=89 and score>=80): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
task 1.a | |
a = int(input()) | |
print("Loaves Discount") | |
r=185*a | |
d=0.6*r |