Professional Documents
Culture Documents
Laboratory-No-1 Gonzales
Laboratory-No-1 Gonzales
DECISION STRUCTURES
Code:
number_of_books = int(input("Enter the number of books purchased: "))
message = ""
if number_of_books < 0:
message = "Error. Enter a positive number. \n" + \
"Re-run program and try again."
else:
message = "You are awarded "
message += "points."
B. Software Sales
A software company sells a package that retails for $199. Quantity discounts are given
according to the following table:
Quantity Discount
10–19 5%
20–49 10%
50–99 20%
100 or more 50%
Design a program that asks the user to enter the number of packages purchased. The program
should then display the amount of the discount (if any) and the total amount of the purchase after
the discount.
display_message = ""
if number_of_packages < 0:
display_message = "Error. # of packages must be greater than 0.\nRe-run program and try
again."
else:
discount_percentage = 0
Write a program that will allow a student to enter four (4) test score and then average the inputted test
scores and display the numeric equivalent grade for that score.
Code:
# Declaring Variables
FullName = input("Enter your FullName:")
Course = input("Enter your Course Major:")
Subject = input("Enter your Sr-code:")
PrelimGrade = input("Enter your PrelimGrade:")
MidtermGrade = input("Enter your MidtermGrade:")
SemisGrade= input("Enter your SemisGrade:")
FinalGrade = input("Enter your FinalGrade:")
# Simulation of Variables
print("Name:"+str(FullName))
print("Course:"+str(Course))
print("Subject:"+str(Subject))
print("PG:"+str(PrelimGrade))
print("MG:"+str(MidtermGrade))
print("FG:"+str(FinalGrade))
# Conditional statement
if (semestralGrade >= 0) and (semestralGrade <= 74):
print("Remarks:FAILED")
print("Just work harder next time and you will be fine.")
elif (semestralGrade >= 75) and (semestralGrade <= 100):
print("Remarks:PASSED")
print("Congratulations you did great!")
elif (semestralGrade >= 101) or (semestralGrade <= 0):
print("Remarks:INC")
- (insert here)
B. Software Sales
- (insert here)
C. Grading System
- (insert here)