Python Questions
Python Questions
Validating Alliteration
Grade settings: Maximum grade: 100
Disable external file upload, paste and drop external content: Yes
Based on: Validating Alliteration(---RETIRED---)
Run: Yes Evaluate: Yes
Automatic grade: Yes Maximum memory used: 320 MiB
Concepts Covered:
• Strings
• Functions
Problem Description:
Build a logic in python to check if the given sentence is alliterative or not.
The main method is excluded from the evaluation. You are free to write your own
code in the main method to invoke the business method and to check its
correctness.
Note:
Sample Input 1:
Enter the sentence to be validated for alliteration: She sells sea shells
Sample Output 2:
The sentence is alliterative
Sample Input 2:
Enter the sentence to be validated for alliteration: Ann sells sea shells
Sample Output 2:
The sentence is not alliterative
-------------------------------------------------------------------------
Q2 Find Relationship
Grade settings: Maximum grade: 100
Disable external file upload, paste and drop external content: Yes
Based on: Find Relationship(---RETIRED---)
Run: Yes Evaluate: Yes
Automatic grade: Yes Maximum memory used: 320 MiB
Concepts Covered:
• Strings
• Functions
Problem Description:
Mr. George is a software developer. He wants to develop software that can identify the
relationships between the users if they entered their names. According to his requirement, the
program should get two names from the users and, based on the total length of the names
entered, it should find out the relationship between the persons with that name. Help him
develop the software using Python.
Note:
Process flow:
• In the 'main' method, get two names from the user.
• Invoke the method 'find_relationship' and pass the two names as arguments.
• Capture the relationship value returned from the method, and display it as specified in
the sample input and output.
The main method is excluded from the evaluation. You are free to write your own code
in the main method to invoke the business methods to check its correctness.
Note:
• In the sample Input / output provided, the highlighted text in bold corresponds to the
input given by the user, and the rest of the text represents the output.
• Do not alter the given code template. Write your code only in the necessary places.
• Strictly follow the naming conventions for functions as specified in the problem
description.
Sample Input 1:
Sample Output 1:
Friends
Sample Input 2:
Sample Output 2:
Best friends
Sample Input 3:
Sample Output 3:
Soulmates
Sample Input 4:
Sample Output 4:
Friends
Q3 Sentence Palindrome
• Strings
• Functions
Problem Description:
The program must get a sentence as input and pass this sentence to an
is_palindrome() function which checks if the given sentence is a palindrome or not
and returns back a boolean value to the main
Process flow:
Concepts Covered:
• Strings
• Functions
Problem Description:
Kate was under treatment for High Blood Pressure (BP) for the past 6 months. He
used to self-check his BP reading. He wants to know the status of his BP level. Help
him by writing a program in Python to find the BP status for him. Get Systolic and
Diastolic as single input separated with '/' ( 90/70) from the user and tell the status
of the BP level.
Process flow:
• In the 'main' method, get the BP level from the user ("/" separated)
• Call the 'generate_status' method and pass this input string as its argument
and capture the string returned by the method
• Display the status returned by the function as specified in the sample input
and output statements
The main method is excluded from the evaluation. You are free to write your own
code in the main method to invoke the business methods to check its correctness.
Note:
Sample Input 1:
90/70
Sample Output 1:
Normal
Sample Input 2:
145/98
Sample output 2:
High BP
Q5 Flat Discount
Grade settings: Maximum grade: 100
Disable external file upload, paste and drop external content: Yes
Based on: Flat Discount(---RETIRED---)
Run: Yes Evaluate: Yes
Automatic grade: Yes Maximum memory used: 320 MiB
Concepts Covered:
• Strings
• Functions
Problem Description:
'WeBuild' construction is a famous construction company that sells apartments at
low prices. All the flats have 2BHK and 3BHK houses. Based on the sum of house
number and house type they had decided to give a discount for their customers from
the house amount. Help the company to calculate the discount for their customer
based on given conditions.
Requirement: Define a function with the name 'calculate_discount()'
House House
Cost Discount
Type Number sum
2BHK 3900000 Odd Number 4
3BHK 5100000 Odd Number 8
2BHK 3700000 Even Number 5
3BHK 4900000 Even Number 7
Process flow:
• In the 'main' method, get the house number and house type from the user
as colon-separated values.
• Invoke the 'calculate_discount' method and pass the input_string as an
argument to capture the discount amount and display it as specified in the
sample input and output.
The main method is excluded from the evaluation. You are free to write your own
code in the main method to invoke the business methods to check its correctness.
Note:
Sample Input 1:
123:2BHK
Sample Output 1:
185000.0
Sample Input 2:
435:3BHK
Sample Output 2:
343000.0
Concepts Covered:
• Strings
• Functions
Problem Description:
Mr. Lenny wants to create an application to find a lucky number based on the date of birth.
When this app receives the user's date of birth, it sums each value of the date of birth to
determine the lucky number. Help him develop software using Python.
28 + 08 + 1999= 2035
2+0+3+5=10
• Invoke the method 'find_lucky_number' and pass the input string as arguments.
• Capture the value returned from the method, and display it as specified in the sample
input and output.
The main method is excluded from the evaluation. You are free to write your own code
in the main method to invoke the business methods to check its correctness.
Note:
Sample Input 1:
24/04/1990
Sample Output 1:
Sample Input 2:
11-11-2001
Sample Output 2:
Invalid format
Sample Input 3:
33/14/2999
Sample Output 3:
Invalid format
Q7 Toll Check
Grade settings: Maximum grade: 100
Disable external file upload, paste and drop external content: Yes
Based on: Toll Check(---RETIRED---)
Run: Yes Evaluate: Yes
Automatic grade: Yes Maximum memory used: 320 MiB
Concepts Covered:
• Strings
• Functions
Problem Description:
The National Highways Department has announced a discount scheme for four-
wheelers at the toll gate as part of its 50th-year celebration.
If the vehicle number plate's last four character sum is an odd number, then they will
receive an even place sum discount. They will receive the odd place sum discount if
the last four-character sum is an even number. Using the function below, assist them
in creating an application in Python for the aforementioned purposes.
Process flow:
• In the 'main' method, get the vehicle number as the user input string.
• Then call the 'check_number' method and pass the vehicle number as an
argument.
• Display the values returned by the function.
The main method is excluded from the evaluation. You are free to write your own
code in the main method to invoke the business methods to check its correctness.
Note:
Sample Input 1:
Sample Output 1:
Sample Input 2:
Sample Output 2:
Sample Input 3:
Sample Output 3:
Q8 Find Grade
Grade settings: Maximum grade: 100
Disable external file upload, paste and drop external content: Yes
Based on: Find Grade(---RETIRED---)
Run: Yes Evaluate: Yes
Automatic grade: Yes Maximum memory used: 320 MiB
Concepts Covered:
• Strings
• Functions
Problem Description:
The NNN Academy conducts an exam for its students. They want to develop
software to find their students' exam results. As per their software, the student gets
2 marks for correct answers and 1 negative mark for wrong answers. Then calculate
the students' mark percentage. Based on the percentage of students, the result
should be determined. Help them develop software using Python.
Get the correct and incorrect answers to count from the user. then invoke the
following function to find the exam result.
Percentage=(total marks/120)*100
Process flow:
• In the 'main' method, get the correct and incorrect answer counts from the
user.
• Invoke the method 'find_exam_result' and pass the correct and incorrect
answer counts as arguments.
• Capture the value returned from the method, and display it as specified in the
sample input and output.
The main method is excluded from the evaluation. You are free to write your own
code in the main method to invoke the business methods to check its correctness.
Note:
Sample Input 1:
Sample Output 1:
Sample Input 2:
Enter the count of correct answers:40
Sample Output 2:
Sample Input 3:
Sample Output 3:
Q9 Product Code
Grade settings: Maximum grade: 100
Disable external file upload, paste and drop external content: Yes
Based on: Product Code
Run: Yes Evaluate: Yes
Automatic grade: Yes Maximum memory used: 512 MiB
Concepts Covered:
• Strings
• Functions
Problem Description:
A manufacturing company ships the product to a specific location. For that, they need a code
for each product. The code is generated based on the product name, destination location, and
manufactured month and year. Help them generate code in Python.
Requirement: Define a function with the name 'generate_code()'
If all the details are valid, then generate the product code.
• In the 'main' method, get the sentence and a word from the user.
• Call the 'generate_code' method and pass the sentence and the word as its
arguments.
• Capture the string returned by the function and display it.
The main method is excluded from the evaluation. You are free to write your own code
in the main method to invoke the business methods to check its correctness.
Note:
Sample Input 1:
Mask: Pune:11:2019
Sample Output 1:
ASK/PE/1119
Sample Input 2:
Enter the details:
Sanitizer: Florida:9:2019
Sample Output 2:
SAN/FA/919
Sample Input 3:
Sanitizer: Bo:13:2019
Sample Output 3:
Concepts Covered:
• Strings
• Functions
Problem Description:
A social media company wants to process users' posts to replace any unwanted
words before they are published on the platform. Help him by writing a Python
program to replace the unwanted words.
Process flow:
• In the 'main' method, get the sentence and a word from the user.
• Call the 'replace_word' method and pass the sentence and the word as its
arguments.
• Capture the string returned by the function and display it.
The main method is excluded from the evaluation. You are free to write your own
code in the main method to invoke the business methods to check its correctness.
Note:
Sample Input 1:
Damn
Sample Output 1:
Sample Input 2:
our
Sample Output 2:
Sample Input 3:
delay
Sample Output 3:
Concepts Covered:
• Strings
• Functions
Problem Description:
Shopjee is one of the famous online markets. The market intends to provide its
customers with a secret code in order to facilitate their purchases. If the customer
wants to purchase a product, they must provide their username and secret key. The
secret key is a single character that is the average of the ASCII values of their
username. Help them create an application in Python to create the secret key using
the below-mentioned function.
Note:
Make use of ord() and chr() methods for getting
the ASCII value (Unicode value) of a character
and for converting an ASCII (Unicode) to the
corresponding character.
Process flow:
The main method is excluded from the evaluation. You are free to write your own
code in the main method to invoke the business methods to check its correctness.
Note:
Sample Input 1:
Sample Output 1:
k
Sample Input 2:
Sample Output 2:
Invalid Input
Sample Input 3:
Ab123
Sample Output 3:
Invalid Input
Concepts Covered:
• Collections
• Functions
Problem Description:
BestOne is a top training institute. The institute has a large number of trainers to
train new candidates who join their institute. In the end, the candidates have to give a
rating to the trainers based on the training they have taken. The institute wants to
know how many candidates gave ratings between 0 - 5 (inclusive) and 6 and above
so that they can give some incentives to the trainer. Write a program in Python to
simulate this scenario.
Process flow:
• In the 'main' method, get a string of trainer details (trainer_id:
ratings) separated with a comma (',').
E.g.: WW23:4,RR45:8,YY12:1
• Call the 'create_ratings' method and pass this input string as its argument and
capture the dictionary returned by the method.
• Then call the 'count_ratings' method and pass the dictionary of ratings as its
argument.
• Display the values returned by the function as specified in the sample input
and output statements.
• If any or all of the list returned by the 'count_ratings' function is empty then
display the message 'Nil' as shown in the sample output statements.
The main method is excluded from the evaluation. You are free to write your own
code in the main method to invoke the business methods to check its correctness.
Note:
Sample Input 1:
Sample Output 1:
The list of trainers with ratings between 6 and above: ['TT11', 'WQ34', 'BN01', 'BN01','
PL23']
Sample Input 2:
Enter the ratings (as comma-separated values): WE01:0, TR02:1, PO02:4, IT05:2
Sample Output 2:
The list of trainers with ratings between 0-5: ['WE01', 'TR02', 'PO02',' IT05']
Sample Input 3:
Enter the ratings (as comma-separated values): WE01:10, TR02:6, PO02:7, IT05:9
Sample Output 3:
The list of trainers with ratings between 6 and above: : ['WE01', 'TR02', 'PO02',' IT05']
Concepts Covered:
• Collections
• Functions
Problem Description:
Buddy's academy is one of the most famous gaming academies in our city. They
conduct 3 types of games for the kids. As part of the game, their average points will
be calculated. From their average points, they are selected for the next round. Help
the academy select the participants for the next level using the Python program.
Requirement 1: Define a function ' calculate_score()'
Example:
• In the 'main' method, get the participant name, and each round point from the
user as colon (":") separated values (already given in the code template) and
append it to a list.
• Call the 'calculate_score' method and pass the list of participants' details and
capture the list of dictionaries returned by the function and display it.
• Then call the 'filter_participants' method and pass the participants' dictionary
and pass the score to the method for filtering the participants and appends
the name of the participants who are selected for the next level to a list and
returned the same. If the function returns an empty list, display the message
as " No one selected".
The main method is excluded from the evaluation. You are free to write your own
code in the main method to invoke the business methods to check its correctness.
Note:
Johan:77:87:69
Smith:44:65:56
George:99:73:56
Benny:67:67:33
Johan
George
James:70:82:66
Livi:47:75:36
Ronn:96:73:56
No one selected
Concepts Covered:
• Strings
• Collections
• Functions
Problem Description:
Process flow:
• In the 'main' method, the input for the program is given along with the code
template. The input format should be:
In the from_date and to_date input values, the first two digits represent the
days and the next two digits represent the month.
Example: ARO123:Smith:Double:12/05:13/05
• Call the 'calculate_days' method and pass from_date and to_date as its
arguments. Capture the days returned by the method.
• Call the 'calculate_total_amount' method and pass customer_name,
room_type, and no_of_days as parameters.
• Display the values returned by the function as specified in the sample input
and output statements.
The main method is excluded from the evaluation. You are free to write your own
code in the main method to invoke the business methods to check its correctness.
Note:
• In the sample input/output provided, the highlighted text in bold corresponds
to the input, and the rest of the text represents the output.
• Do not alter the given code template. Write your code only in the necessary
places alone.
• Strictly follow the naming conventions for variables and functions as
specified in the problem description.
Sample Input:
ARO123:Smith:Double:12/05:13/05
Sample Output:
No of days: 1
Concepts Covered:
• Functions
• Collections
Problem Description:
F2 conducts a bike race event. At the end of the event, they want to know how many
participants are qualified for the next level. Get the total number of participants for
the race and the biker's Id, name, and speed from the user. Based on the speed, find
out the time taken to complete the race, and display the participants who are all
qualified for the next level based on the given time.
Write a Python program to find the count of participants qualified for the next level.
Note: Round off the completion time for one (1) decimal place.
[{'Id':'BK12','Name':'Keane','Time':
2.5}, {'Id':'BK23','Name':'Smith','Time':3.3},{'Id':'BK03','Nam
Iterate through this list, and find out the qualifiers for
the next level based on the qualifying time provided.
Any participants who have taken less than or equal to
the time specified by the user are qualified for the next
level.
Process flow:
• In the main() method, get the no. of racers and their details as specified in the
sample input statements. (already given in the code template) and append it
to a list.
• Call the 'calculate_time' method and pass the list of race details and capture
the list of dictionaries returned by the function.
• Then call the 'find_qualifiers' method and pass this list of dictionaries to the
method for identifying the qualifiers and display the list of qualifier names
returned. If the function returns an empty dictionary, display the message as
"No one is qualified".
Note:
• Get the number of racers and the racers' details (biker id, name, and
speed) from the user. Get the racer details as a single string separated
by ':' (colon). Refer to the sample input and output statements for more
clarifications.
Example:
BK12:Keane:80
BK23:Smith:60
BK03:Maxi:85
• Do not alter the given code template. Write your code only in the necessary
places.
• Strictly follow the naming conventions for functions as specified in the
problem description.
BK12:Keane:80
BK23:Smith:60
BK03:Maxi:85
Keane
Maxi
BK12:Glenn:56
BK45:Ruby:45
No one is qualified
Q16 Deducing Blood Group
Grade settings: Maximum grade: 100
Disable external file upload, paste and drop external content: Yes
Based on: Deducing Blood Group(---RETIRED---)
Run: Yes Evaluate: Yes
Automatic grade: Yes Maximum memory used: 320 MiB
Concepts Covered:
• Collections
• Functions
Problem Description:
SNAS laboratory decided to develop software to deduce the blood group of a person
based on two factors.
i. antigens and antibodies type present
ii. presence or absence of the RhD antigen
Get the input from the user as a comma-separated string like 4 y/n (yes or no)
corresponding to the presence or absence of A antigens, B antigens, anti-A
antibodies, anti-B antibodies, and + or - corresponding to the presence or absence of
the Rh factor.
Note:
Process flow:
The main method is excluded from the evaluation. You are free to write your own
code in the main method to invoke the business methods and to check for their
correctness.
Note:
Sample Input 1:
Enter y/n for A antigens, y/n for B antigens, y/n for anti-A antibodies, y/n for anti-B
antibodies, and +/- for Rh factor (as comma separated values):y,y,n,n,-
Sample Output 1:
Deduced blood group: AB-
Sample Input 2:
Enter y/n for A antigens, y/n for B antigens, y/n for anti-A antibodies, y/n for anti-B
antibodies, and +/- for Rh factor (as comma separated values): y,n,y,n,+
Sample Output 2:
Incorrect combination of antigens/antibodies entry
Remaining time
Live Proctoring
Qualifier Assessment
Participants
Grades
Python Basics
Python Collection
Python
ANSISQL Joins
ANSISQL
Help Desk
Q17 Cricket Academy
Grade settings: Maximum grade: 100
Disable external file upload, paste and drop external content: Yes
Based on: Cricket Academy(---RETIRED---)
Run: Yes Evaluate: Yes
Automatic grade: Yes Maximum memory used: 320 MiB
Concepts Coverage:
• Functions
• Collections
Problem Description:
Requirement: Create player details, store them, and display them using functions.
Process flow:
1. In the main method, if the user enters option 1, get the player details such as
player id, name, matches played, and runs scored, from the user and pass those
details to the function ' create_player'. This method should return a dictionary of
player details and append this dictionary to the list 'players_details'.
3. Option 3 is to stop the program execution. When the user chooses this
option, display the message "Thank you" and exit. Please do not use 'sys. exit()'
. Instead, use the 'break' statement.
The main method is excluded from the evaluation. You are free to write your own
code in the main method to invoke the business methods to check its correctness.
Note:
1. Create Player
3. Exit
1. Create Player
3. Exit
1. Create Player
3. Exit
Matches played: 20
1. Create Player
3. Exit
Enter the option: 2
Player 1 :
Id: ICC345
Name: Dhoni
Matches_Played : 400
Runs_Scored : 6789
Player 2 :
Id: ICC890
Name: Rohit
Matches_Played : 20
Runs_Scored : 568
1. Create Player
3. Exit
Thank you
1. Create Player
3. Exit
Enter the option: 1
Matches played: 2
Runs scored: 56
1. Create Player
3. Exit
1. Create Player
3. Exit
Thank you
Concepts Covered:
• Collections
• Functions
Problem Description:
At SRS College, "Rainbow FM" has arranged a game among college students. Mr.
Joe, who is the organizer of this event, divided some students into two teams and
conducted the events between them. Help the organizer identify the winning team in
each round and each team's win count in the game by using a Python program.
Get the number of rounds and each round's points for team 1 and team 2 from the
user and store them in two lists separately.
For example,
Process flow:
• In the 'main' method, get the number of rounds and each round's points from
the user and store them in a list.
• Invoke the method 'find_each_round_winner' by passing the list of team1 and
team2 as its argument. Capture the winner details returned by the method.
• Then invoke the method 'count_winners' by passing the winner's details list
returned by the previous method as its argument. Store the dictionary that
contains the winning count of each team returned by the function and display
it as specified in the sample input and output statements.
The main method is excluded from the evaluation. You are free to write your own
code in the main method to invoke the business methods to check its correctness.
Note:
Sample Input 1:
Sample Output 1:
Team1: 1
Team2: 2
Equal: 2
Sample Input 2:
5
Enter the team2 points:
Sample Output 2:
Team1 : 3
Team2 : 0
Equal : 0
Sample Input 3:
-4
Sample Output 3:
Invalid rounds
Concepts Covered:
• Collections
• Functions
Problem Description:
The program is a to-do list manager that allows a user to add tasks to a list and mark them as
completed once the task is completed. The program should store the tasks in a list that
maintains the order in which the tasks were added and allows tasks to be efficiently removed
by their index once it is completed.
To implement the to-do list manager, we could use a list from the collections to store the
tasks.
Process flow:
• In the 'main' method, if the user enters "1", get the task, from the user and pass
the task and todo_list to the function 'add_task'.
• If the user enters "2", get the index, from the user and pass the index and
todo_list to the function 'mark_task_complete' and then display the todo_list
as specified in the sample input and output.
• If the user enters "3" then stop the program execution. Please do not use 'sys.
exit()' . Instead, use the 'break' statement.
• If the user enters other than "1", "2" or "3" then display the message "Invalid
command" and exit. Please do not use 'sys. exit()' . Instead,
use the 'break' statement.
The main method is excluded from the evaluation. You are free to write your own code
in the main method to invoke the business methods to check its correctness.
Note:
Schedule Meetings
Invalid Input
Invalid command
Invalid Input
Concepts Coverage:
• Functions
• Collections
Problem Description:
A new vaccination center in the city wants an automated system that will help them
to create and maintain the details of children who have booked for vaccination.
Develop a Python application to meet this requirement.
Requirement: Create the records of children who have booked for vaccination, store
them, and display them using functions.
{"Name":<name of the
child>,"Gender":<gender of the
child>,"Weeks":<no. of weeks since
birth>, "Contact":<contact number of the
guardian or parent>}
Process flow:
• In the main method, get the number of children and children details name,
gender, week, and contact) as a string of colon-separated values from the
user and append it to children_record.
• Invoke the "create_record' method, and pass the list of children's details as the
argument. If this method returns an empty list to the caller, then display the
message "No records available"
• If the list is not empty, get the weeks from the user and
invoke the 'display_record' method and pass the list of the dictionary
(valid_records) and the weeks as arguments, and display the message based
on the description.
Note:
Bobs: M:8:8876556789
Joshna: F:6:9867577881
Math: M:24:8769567465
Ann: F:16:9095023412
Sweety:F:25:9798422137
To display the records based on weeks since birth - Enter the no of weeks(<=24):10
Record 1 :
Name: Bobs
Gender: M
Weeks: 8
Contact: 8876556789
Record 2 :
Name: Joshna
Gender: F
Weeks: 6
Contact: 9867577881
There are 2 children under 10 weeks who have booked for the vaccination
2
Enter name, gender, weeks, and contact as colon-separated values:
Neo: M:12:9095023491
Josh: F:25:9798422137
To display the records based on weeks since birth - Enter the no of weeks(<=24):10
Concepts Covered:
• Collections
• Functions
Problem Description:
You are a software engineer at a sportswear leather products sales company, and
you have been asked to build a program in Python that helps to check the stock
details and place orders for customers. The program should allow users to check the
current availability of a specific item, place an order with the cost of the specified
item and display the remaining stock details.
total_amount= qunatity*price
Process Flow:
• In the 'main' method, get the item name and quantity from the user.
Note: You are provided with two dictionaries stock and prices. The 'stock'
the dictionary contains the name of the items as the key and the available
quantity
as the value whereas the 'prices' dictionary contains the name of the item as
the key and the price of the item as the value.
• Call the 'check_availability' method and pass item name, quantity, and
stock dictionary as its argument and capture the boolean value returned by
the method
• If the 'check_availability' method returns True then call the method
'place_order' and pass the item name, quantity, stock, and prices dictionaries
as its arguments. The function should display the total amount and the stock
dictionary after reducing the required quantity.
• If the 'check_availability' method returns False then display the message as
"Item is not available" and terminate the program.
The main method is excluded from the evaluation. You are free to write your own
code in the main method to invoke the business methods to check its correctness.
Note:
Sample Input 1:
Enter a quantity: 4
Sample Output 1:
Sports Balls: 56
Shin guards: 50
Gloves: 56
Footwear: 15
Sample Input 2:
Enter a quantity: 3
Sample Output 2:
Concepts Covered:
• Collections
• Functions
Problem Description:
You are a data scientist at a healthcare company, and you have been asked to build a
program that helps doctors predict the likelihood of a patient developing a certain
disease based on various risk factors. The program should allow doctors to enter
patient data as a colon-separated string, such as age, gender, blood pressure, and
cholesterol level, and output a probability score indicating the likelihood of the
patient developing the disease.
To solve this problem, you could write a Python program that defines the following
functions:
Example:
probability = 1 - (1 / (1 + risk_score))
Note:
Process flow:
• In the 'main' method, get the input patient data separated with a colon(:,').
• Call the 'compute_risk_score' and pass this patient data as its argument and
capture the risk_score returned by the method.
• Then call the 'predict_probability' and pass the risk_score as its argument.
• Display the probability score value returned by the function as specified in the
sample input and output statements.
The main method is excluded from the evaluation. You are free to write your own
code in the main method to invoke the business methods and to check for its
correctness.
Note:
Sample Input 1:
62:M:125:210
Sample Output 1:
44:F:100:180
Sample Output 2:
Concepts Covered:
• Strings
• Functions
• Collections
Problem Description:
Zee Cinema is one of the most famous theaters in the city. They have a large parking
area to park all the vehicles. The parking area is divided into 2 blocks, A block for
parking two-wheeler and B block for parking four-wheelers. When they enter vehicle
details, first they need to validate the license number, and then they want to generate
the parking id and amount based on the vehicle type.
Example:
Process flow:
• In the 'main' method, get the vehicle details input from the user in the
following format: vehicle number, customer name, license number, vehicle
type, and duration in hours. (comma separated)
• Call the 'validate_license_number' method and pass vehicle details to validate
the license number. If the license number is valid then return True else
return False.
• If the 'validate_license_number' method returns True then call the method
'generate_parking_id' and pass the parking details to generate the parking id
and amount.
• Capture the dictionary returned by the method and display the values returned
by the function as specified in the sample input and output statements.
The main method is excluded from the evaluation. You are free to write your own
code in the main method to invoke the business methods to check its correctness.
Note:
Sample Input 1:
TN37DE1034,Livi,AA9920126787787,Two wheeler,2
Sample Output 1:
Sample Input 2:
TN40FW1034,Mathew,AA9919976733387,Four wheeler,2
Sample Output 2:
Sample Input 3:
TN40AA1034,Mathew,AG8720006733AA7,Two wheeler,2
Sample Output 3:
Invalid Input
Concepts Covered:
• Functions
• Collections
Problem Description:
Bricks Public School decides to evaluate the mathematical skills of its students.
They are given with a list of numbers and are asked to display the ugly numbers.
Ugly numbers are numbers whose only prime factors are 2, 3 or 5.
Write a Python program to find an ugly number from a given list of numbers.
Process flow:
• In the 'main' method, get the input string as comma separated specified in the
sample input statements. (already given in the code template) and append it
to the number list.
• Then call the is_ugly, pass this number list as an argument and display the
ugly number as specified in the sample input and output.
• If there are no ugly numbers in the given list, then display the message "No
ugly numbers found".
The main method is excluded from the evaluation. You are free to write your own
code in the main method to invoke the business method and check its correctness.
Note:
• In the sample Input / output provided, the highlighted text in bold corresponds
to the input given by the user, and the rest of the text represents the output.
• Do not alter the given code template. Write your code only in the necessary
places.
• Strictly follow the naming conventions for functions, as specified in the
problem description.
Sample Input 1:
Sample Output 1:
81
10
Sample Input 2:
Enter the numbers (as comma-separated values):11,22,33,44,55
Sample Output 2:
No ugly numbers found
Q24 Registration Number
Grade settings: Maximum grade: 100
Disable external file upload, paste and drop external content: Yes
Based on: Registration Number(---RETIRED---)
Run: Yes Evaluate: Yes
Automatic grade: Yes Maximum memory used: 320 MiB
Concepts Coverage:
• Functions
• Collections
Problem Description:
Adler University has planned to conduct a webinar for both; their students and other
University students, for which they collected the register numbers of all
students. Now the University needs to filter the register numbers of other University
students alone. The Adler University student's register number starts with
'7119' and any registration number starts apart from '7119' belongs to other
University students.
Refer to the sample input and output statements for more clarification.
The main method is excluded from the evaluation. You are free to write your own
code in the main method to invoke the business methods to check its correctness.
Note:
Sample Input 1:
Sample Output 1:
Register numbers of students from other Universities:
[710617104025,711217104086,717618104078]
Sample Input 2:
Sample Output 2:
Register numbers of students from other Universities: [ ]
Q25 Scholarships
Grade settings: Maximum grade: 100
Disable external file upload, paste and drop external content: Yes
Based on: Scholarships(---RETIRED---)
Run: Yes Evaluate: Yes
Automatic grade: Yes Maximum memory used: 320 MiB
Concepts Covered:
• Collections
• Functions
Problem Description:
Now the university wants to store them in two different lists and needs to identify the
students who do not have scholarships. Write a program in Python to simulate the
same.
After adding all the ids, return that list to the caller
functions.
Process Flow:
• In the 'main' method, get the entire students' ids as a single string separated
by ',' (comma) from the user.
• Then get the ids of the students who are having scholarships as a single
string separated with a comma (',') from the user.
• Call the 'check_scholarships' method and pass these two string inputs as
arguments.
• Capture the list of values returned from the function and display it as
specified in the sample output statements
The main method is excluded from the evaluation. You are free to write your own
code in the main method to invoke the business methods to check its correctness.
Note:
Sample Input 1:
117,112,113,114,115,116,111
113,114,115
Sample Output 1:
113,114,115
117,112,113,114,115,116,111
Sample Output 1:
Invalid data
Sample Input 2:
117,112,113,114,115,116,111
117,112,113,114,115,116,111
Sample Output 1:
Concepts Covered:
• Functions
• Collections
Problem Description:
Dan is playing a video game, in which, his character competes in a hurdle race by
jumping over hurdles with heights. He used to maintain the maximum heights of
units he jumps in each race in his scorecard. But in this scorecard, he can only
append the score one after another. He cannot insert it in the middle or in the
beginning. Dan uses this scorecard to maintain the total no. of scores with a split of
how many score values are equal to or above 50% of the average score value.
Process flow:
• In the 'main' method, get the size of the scorecard from the user and then get
the score values of float type one by one and append it to a list.
• Then call the 'calculate_score' method and pass the list of score values.
• Display the values returned by the function.
The main method is excluded from the evaluation. You are free to write your own
code in the main method to invoke the business methods to check its correctness.
Note:
• In the sample Input/output provided, the highlighted text in bold corresponds
to the input given by the user, and the rest of the text represents the output.
• Do not alter the given code template. Write your code only in the necessary
places.
Sample Input 1:
10
5
1
4
7
2
4
Sample Output 1:
The score values that are equal to or above 50% of the average score: 5
Sample Input 2:
Sample Output 2:
The score values that are equal to or above 50% of the average score: 2
Sample Input 3:
Sample Output 3:
The score values that are equal to or above 50% of the average score: 0
Concepts covered:
• Collections
• Functions
Problem Description:
You are a software engineer at a social media company, and you have been asked to build a
program that takes in a string containing a user's post and a list of keywords and displays
texts that contains one or more of the keywords.
The comments are provided as a single string, with each comment separated by a newline and
the username preceding the comment text, separated by a colon.
Process flow:
• In the 'main' method, input string and keywords are given already.
• Call the method 'analyze_comments' and pass the input string and keywords as
arguments, and display it as specified in the sample input and output.
The main method is excluded from the evaluation. You are free to write your own code
in the main method to invoke the business methods to check its correctness.
Note:
• In the sample input / output provided, the highlighted text in bold corresponds to
the input, and the rest of the text represents the output.
• Do not alter the given code template. Write your code only in the necessary
places.
• Strictly follow the naming conventions for functions as specified in the problem
description.
Sample Input:
"user1: I love this post!\nuser2: This is a great post!\nuser3: I totally agree with
user1\nuser4: This post is amazing!"
Sample Output:
Concepts Covered:
• Collections
• Functions
Problem Description:
TravelWithUs is a travel credit card issuer that provides various offers for travel-
related spending. As a part of the festive season, they planned to give a cash-back
offer to their customers based on the credit points they have earned so far. Find
below the cash-back offer details:
Based on this information, the online shop needs to find out the total cash-back
amount they need to spend for their customers. Write a program in Python to
simulate this scenario.
• In the 'main' method, get the no. of credit card users and credit points of each
user one by one and append it to a list.
• Call the 'calculate_amount' method and pass the list of credit points as its
arguments.
• Capture the cashback amount returned by the function and display it.
The main method is excluded from the evaluation. You are free to write your own
code in the main method to invoke the business methods to check its correctness.
Note:
Sample Input 1:
Sample Input 2:
Sample Output 1:
Concepts Covered:
• Collections
• Functions
Problem Description:
ZEE Film Fare Association released a new movie. They decided to find out whether
the movie received the highest or lowest rating feedback from viewers. Help them
create an application in Python to find the highest rating using the below mentioned
function.
Requirement: Define a function with the name 'check_rating()''
Process flow:
• In the 'main' method, get the number of viewers and the rating from the user
and append it to a rating_list.
• If the ratings are not between 0 to 10 display the message as "Invalid Rating"
and ignore those ratings.
• Then call the 'check_rating' method and pass the rating list as the argument.
• Display the values returned by the function.
The main method is excluded from the evaluation. You are free to write your own
code in the main method to invoke the business methods to check its correctness.
Note:
Sample Input :
Enter the number of viewers: 5
Sample Output :
Sample Input 2:
Sample Output 2:
Sample Input 3:
6
8
Sample Output 3:
Concepts Covered:
• Collections
• Functions
Problem Description:
Lotus Marketing Company is one of the best sales firms in the city.
They will select two representatives each quarter and compare their achieved sales
targets over a few days to determine which representative will be promoted. for
this, they collect the sales details of the two selected representatives, compare their
daily sales, and determine the winner. Assist them in determining the winner using
the Python program.
Example:
Process flow:
• In the 'main' method, get the number of days, and, for each day, get the sales
details of both representatives from the user and append that to a separate
list.
• Call the 'find_winner' method and pass the sales_rep1 and
sales_rep2 sales lists as its arguments.
• Capture the string returned by the function and display it.
The main method is excluded from the evaluation. You are free to write your own
code in the main method to invoke the business methods to check its correctness.
Note:
Sample Input 1:
Enter the number of days: 5
21
34
45
67
54
67
43
54
67
56
Sample Output 1:
Concepts Covered:
• Collections
• Functions
Problem Description:
Mr. Helen decided to develop software to analyze the daily temperature. The
software shows the average temperature and the day with the highest temperature
from a list of daily temperatures. Help him develop software using a Python
program.
Average_temperature = total
temperature/length of the list.
Process flow:
• In the 'main' method, get the temperature of each day as a string separated by
commas ('',').
• Call the 'find_average_temperature' method and pass the input_string as its
arguments.
• Capture the value returned by the function and display it as per the sample
input and output statement.
The main method is excluded from the evaluation. You are free to write your own
code in the main method to invoke the business methods to check its correctness.
Note:
Sample Input 1:
Enter the temperatures of each day, separated by commas:31,33,35,37,28,33,41,36
Sample Output 1:
Concepts Covered:
• Collections
• Functions
Problem Description:
The health care department of XYZ hospital wants to provide its patients with
information on their calorie requirement to maintain weight, based on age, gender,
height, weight, and particularly their activity level. Write a Python program that will
perform the calorie requirement calculation.
Get the gender and activity level from the user as a comma-separated string.
Get the age, height, and weight from the user as a comma-separated string.
Formula :
For a "male",
calorie= ( (10*weight)+(6.25*height)-(5*age)-161
)*activity level value
For a "female",
calorie= ((10*weight)+(6.25*height)-
(5*age)+5 )*activity level value
Process flow:
• In the 'main' method, get the input_string1 (gender and activity level), and
input_string2 (age, height, weight ) as comma-separated values from the user
and convert that into the list (Refer to the sample input statements).
• Then call 'calculate_calories', pass the input_string1_list and
input_string2_list as arguments, capture the calories returned from this
method, and display the same as specified in the sample output.
The main method is excluded from the evaluation. You are free to write your own
code in the main method to invoke the business method and check its correctness.
Note:
Sample Input 1:
Enter the gender and activity level (as comma-separated values): female, sedentary
Enter the age, height, and weight (as comma-separated values): 23,153,60
Sample Output 1:
To maintain your current weight, you'll need 1735.5 calories per day