BIS1003-Introduction to Programming Intensive

profileAbdulmalek
BIS1003_Workshop_Topic3.pdf

BIS1003 Introduction to Programming

Workshop 3

Topic 3: Selection Structures

Apply and test your knowledge of the current and previous topics by attempting the

questions below. Completing these questions will help you to succeed in your subject.

Workshop Questions

1. Write a python program that asks the user to enter an integer number. The program

should validate if the number id positive, negative, or equal zero. If the number is

positive (greater than 0), it should display ‘Positive’. If the number is negative (less

than 0), it should display ‘Negative’, and display ‘Zero’ if it is equal to 0. Also, write

the flowchart of the program.

2. Consider three ticket types at XYZ cinema: Ticket A, Ticket B, and Ticket C. Ticket A

cost $55, Ticket B cost $40, and Ticket C cost $25.

Write a python program that asks the customer to enter the ticket type (A or B or C),

and then the program should display the cost of the ticket.

3. Assume that XYZ cinema awards loyalty points to its customers. According to the

table below, the points are calculated based on their total spending during the year

(rounded figure).

Total spending Points

$0-$200 50

$201-$500 100

More than 500 200

Write a python program that asks the customer to enter the total spending of a year

and then display its points.

4. Write a python program that asks the user to enter three positive numbers. Save

these numbers in three different variables. The program should find the middle of

three numbers and displays it to the user.