CLO3 Part 1 Lab - Solution
CLO3 Part 1 Lab - Solution
ACTIVITY CLO3_1
CHAPTERS:
TOOLS: PYTHON/REPL.IT
PROCEDURE: CODING
1
EXERCISE 1-APPLY
Write a python program using selection that will read two different ages and display the
youngest age (use repl.it). Create an algorithm first using simple English words and then
translate it into the code.
Algorithm Solution
Code Solution
age1= int(input("Enter the first person age: "))
age2= int(input("Enter the second person age: "))
else:
young = age2
EXERCISE 2 -APPLY
Write a program that displays a menu of two choices “1. Express, 2. Standard”. The user will
then select their option. The program should then display 4000 for express cost or 2500 for
stander visa processing (use repl.it). Create an algorithm first using simple English words and
then translate it into the code.
Screenshot
2
Algorithm Solution
Ask user to input a Visa Type of either 1 for Express or 2 for Standard
Read in the value entered and assign it to Visa Type
Solution
VisaCharge=0
if (VisaType==1):
VisaCharge=4000
else:
VisaCharge=2500
EXERCISE 3-APPLY
Write a program that reads the student mark and absent percentage and display proper
message considering the pass mark is 60 and the course drop rate is 15%. Create an algorithm
first using simple English words and then translate it into the code.
Screenshot
3
Algorithm Solution
Solution
if (mark>=60):
print ("Pass")
else:
print ("Fail")
if (absence>=15):
print ("Drop from the course ")
else:
print ("Continue the course")
EXERCISE 4 -APPLY
Write a program that displays a menu of two choices “1. UAE, 2. Non-UAE” and the user
will select his option, the program read the user age and display if he is eligible for the
National Medial Card or not. Users with UAE citizenship and age greater than 18 years old
4
are eligible (use repl.it). Create an algorithm first using simple English words and then
translate it into the code.
Screenshot
Algorithm Solution
Ask user to input a Nationality Code of either 1 for UAE or 2 for Non-UAE
Read in the value entered and assign it to Nationality Code
else
print You are NOT eligible for the National Medical Card
Solution
EXERCISE 5 -APPLY
5
Write a program that reads age of a person and displays “Entry restricted to mall” if the given
age is below 10 or above 69, otherwise display “You can enter the mall”(use repl.it). Create
an algorithm first using simple English words and then translate it into the code.
Algorithm Solution
else
print You can enter the mall
Solution
AUTHOR
AIM
CASE DESCRIPTION
QUESTIONS
1. Question 1 description
2. Question 1 description
3. Question 3 description
6
4. Question 4 description
5. Question 5 description
6. Question 6 description
Green color means these questions were solved in the previous activities
Black color indicates that the question be will treated in the current activity
Gray color means that these questions will be investigated during the upcoming activities