Professional Documents
Culture Documents
INSTRUCTION: Upload this document (as PDF file) with your python code and output screenhot as your answer.
1. Andrew, Andrei and Andres are engineering classmates looking for a dormitory to stay for the coming school year.
They will share the monthly payment for the dormitory according to their agreement. This is their agreement.
Andrew will pay 40%, Andrei will pay 35% while Andres will pay the remaining balance. Create a program that will
ask for the monthly rate of the dormitory, and will display the follo wing:
a. How much is the total monthly contribution of Andrew, Andrei and Andres.
b. How much is the total rent in the dormitory for the whole school year, assuming it will last for 10 months
c. How much will Andrew, Andrei and Andres prepare for the whole school year
x = int(input("Please input the monthly rate:")) Paste program output screenshot here*
2. Create a python script for a simple cashier system that will satisfy the following conditions.
a. Input the price of three items the customer bought in a department store, as well as the customer’s
payment.
b. A customer will have a 20% discount if the total amount rendered is greater than 5000php.
c. Get the tax of 10% from the discounted price
d. If the payment is insufficient, display “Insufficient Funds”
e. If the payment is exact amount, display “Thank you for giving an exact amount”
f. Display the change of the transaction
T-CPET121LA
Introduction to Computational Thinking
De La Salle University - Dasmariñas 2
CEAT – Engineering Department
T-CPET121LA
Introduction to Computational Thinking
De La Salle University - Dasmariñas 3
CEAT – Engineering Department
3. Create a simple calculator. Your python script will require you to input two numbers and the keyword that
corresponds to the arithmetic operator to be performed, and then display the result. The following below are the
keyword with the operators to be used. Display “ERROR” if the user input wrong operator.
ADD – Addition SUB – Subtraction
MUL – Multiplication DIV – Division (show separately the remainder)
x =int(input("Input the first number: "))
y = int(input("Input the second number: "))
action = str(input("Input an operation:\nADD = Adddition\nSUB = Subtraction\nMUL =
Multiplication\nDIV = Division\n: "))
if action == "ADD":
print("SUM:", x+y)
elif action == "SUB":
print("DIFFERENCE:", x-y)
elif action == "MUL":
print("PRODUCT:", x*y)
elif action == "DIV":
print("QUOTIENT:", x//y, "REMAINDER", x%y)
else:
print("Invalid")
4. The fuel tank capacity of CarA is 20L, CarB is 30L and CarC is 35L. Your script will ask for an input price per liter
of diesel and unleaded; and display how much is needed of each car for a full tank, both for diesel and unleaded.
T-CPET121LA
Introduction to Computational Thinking
De La Salle University - Dasmariñas 4
CEAT – Engineering Department
5. Input three numbers, display the LARGEST number among the three.
x = int(input("Input the first number: "))
y = int(input("Input the second number: "))
z = int(input("Input the third number: "))
if (x>y):
if(x>z):
print("The largest number among the three is: ", x)
else:
print("The largest number among the three is:", z)
else:
if(y>z):
print("The largest number among the three is:", y)
else:
print("The largest number among the three is:", z)
6. Search on available resources regarding Python Logical Operators/Compound Statements. Complete the table
below.
Logical Explain how does this logical operator works. When will it return a
Symbol
Operator TRUE?
7. Input three numbers, display the LARGEST number among the three. (Use Logical Operator)
T-CPET121LA
Introduction to Computational Thinking
De La Salle University - Dasmariñas 5
CEAT – Engineering Department
T-CPET121LA
Introduction to Computational Thinking