Pseudo and Flow Chart

(1) Write a pseudo code and draw a flowchart to find the sum of two numbers.

 

(2) Write a pseudo code and draw a flowchart to calculate the summation, subtraction, multiplication and division of two numbers.

 

(3) Write a pseudo code to calculate the area of a circle using the formula.

Area = pi * radius * radius. (pi = 3.14)

 

(4) Write a pseudo code to input the two sides of a rectangle. Calculate the area of the rectangle and print out the answer.

Area = Length * Width

 

(5) Write a pseudo code to convert the given celcius temperature to fahrenheit.

Tc = 5/9 * (Tf – 32)

 

(6) Write a pseudocode to convert the given time in hours to minutes.

 

(7) Write a pseudo code and draw a flowchart to check the given mark is pass or fail. (pass mark is 50)

 

(8) Write a pseudo code and draw a flowchart to check the input age is eligible for vote or not. 

 

(9) Write a pseudocode and draw a flowchart to input two numbers and print the larger number.

 

(10) Write a pseudocode and draw a flowchart to check whether the given number is positive, negative or zero.

Problem Set

Level 1

(1) Sum of Two Number (Sum2.py)

Write a Python program that asks the user to enter two numbers.

Calculate and display the total.

Output

Enter first number: 20

Enter second number: 30

Total = 50

 

 

(2) Sum of Three Number (Sum3.py)

Write a Python program that asks the user to enter three numbers.

Calculate and display the total.

Output

Enter first number: 2

Enter second number: 3

Enter third number: 4

2 + 3 + 4 = 9

 

 

(3) Four Arithmetic Operations (Four_Operations.py)

Write a Python program that asks the user to enter two numbers.

Calculate and display:

  • the sum

  • the difference

  • the product

  • the quotient

Display each answer on a separate line.

Output

Enter first number: 12

Enter second number: 4

Sum = 16

Difference = 8

Product = 48

Quotient = 3.0

 

 


 

(4) Total and Average of Three Numbers (Total_Average3.py)

Write a Python program that asks the user to enter three subject marks.

Calculate and display:

  • the total mark

  • the average mark

 

Output

Enter mark for subject 1 : 65

Enter mark for subject 2: 70

Enter mark for subject 3: 67

Total mark is  202

Average mark is 67.3333

 

 

(5) Area of a Rectangle (Area_Rectangle.py)

Write a Python program that asks the user to enter the length and width of a rectangle.

Calculate and display the area.

Formula:

Area = length × width

 

Output

Enter length: 6

Enter width: 4

Area of the rectangle = 24

 

 

(6) Hours to Minutes (Hours2Minutes.py)

Write a Python program that asks the user to enter a number of hours.

Convert the time into minutes and display the answer.

 

Output

Enter hours: 3

Minutes = 180

 

 

(7) Feet to Inches (feet_to_inches.py)

Write a Python program that asks the user to enter a length in feet.

Convert the length into inches and display the result.

Output

Enter length in feet: 5

Length in inches = 60

 

 

(8) Inches to Feet and Inches (inches_to_feet_and_inches.py)

Write a Python program that asks the user to enter a total inches.

Convert it into:

  • feet

  • inches

Hint: Use division and remainder.

Output

Enter length in total inches: 65

Answer = 5 feet and 5 inches

 

 

(9) Celsius to Fahrenheit

Write a Python program that asks the user to enter a temperature in Celsius.

Convert it to Fahrenheit and display the result.

Formula:

Fahrenheit = (9 / 5 × Celsius) + 32

 

Output

Enter temperature in Celsius: 30

Temperature in Fahrenheit = 86.0

 

 

(10) Area and Perimeter of Circle (Area_Perimeter_Circle.py)

Write a Python program that:

  • asks for radius

  • calculates both:

    • area

    • perimeter

  • displays both result

 

 

Output

Enter radius : 3.5

Area of the circle = 38.465

Perimeter of the circle = 21.98

 

 


 

(11) Total Cost with Discount (Total_Cost_Discount.py)

Write a Python program that:

  • asks for the price of one item and quantity

  • calculates total cost

  • calculates a fixed 10% discount

  • displays:

    • total cost

    • discount amount

    • final price

Output

Enter price: 200

Enter quantity: 2

Total = 400

Discount = 40.0

Final price = 360.0

 

 

(12) Total Bill with Tax (Bill_With_Tax.py)

 

Write a Python program that:

  • asks for the price of an item

  • calculates 5% tax

  • displays:

    • tax amount

    • total price after tax

Output

Enter price: 100

Tax = 5.0

Total price = 105.0

 

 

(13) Calculate Total Salary (Total_Salary.py)

 

Write a Python program that:

  • asks for basic salary

  • calculates:

    • allowance = 20% of salary

    • bonus = 10% of salary

  • displays total salary

 

Formula:

Total salary = basic salary + allowance + bonus

 

Output

Enter basic salary: 1000

Total salary = 1300.0

 

 

(14) Decimal Hours to Hours and Minutes (Decimal_Hours_To_HM.py)

 

Write a Python program that asks the user to enter time in decimal hours.

Convert it into:

  • whole hours

  • minutes

Output

Enter time in hours: 2.5

Hours = 2

Minutes = 30

 

 

(15) Swap Two Variables (swap2variables.py)

 

Write a Python program that asks the user to enter two numbers.

Display the values of both numbers before swapping.

Then swap the values of the two variables.

Finally, display the values after swapping.

 

Output

Enter first number: 10

Enter second number: 20

 

Before swapping:

First number = 10

Second number = 20

 

After swapping:

First number = 20

Second number = 10

 

Problem Set

Level 2

Go to Top

1. Positive Number (positive_number.py)

 

Problem:

Input a number. If the number is positive, display Positive number.

Sample output screen

Enter a number: 8

Positive number


2. Pass Mark Alert (pass_mark_alert.py)

 

Problem:

Input a mark. If the mark is 50 or above, display You passed.

Sample output screen

Enter your mark: 72

You passed


3. Adult Check (adult_check.py)

 

Problem:

Input an age. If the age is 18 or above, display Adult.

Sample output screen

Enter your age: 20

Adult


4. Even Number Check (even_number_check.py)

 

Problem:

Input a number. If the number is even, display Even number.

Sample output screen

Enter a number: 14

Even number


5. Discount Message (discount_message.py)

 

Problem:

Input the total purchase amount. If the amount is 100000 or more, display Eligible for discount.

Sample output screen

Enter purchase amount: 120000

Eligible for discount


6. Pass or Fail (pass_or_fail.py)

 

Problem:

Input a mark. If the mark is 50 or above, display Pass. Otherwise, display Fail.

Sample output screen

Enter your mark: 43

Fail


7. Even or Odd (even_or_odd.py)

 

Problem:

Input a number. If the number is even, display Even. Otherwise, display Odd.

Sample output screen

Enter a number: 17

Odd


8. Eligible to Vote or Not (vote_eligibility.py)

 

Problem:

Input an age. If the age is 18 or above, display Eligible to vote. Otherwise, display Not eligible to vote.

Sample output screen

Enter your age: 16

Not eligible to vote


9. Larger of Two Numbers (larger_of_two.py)

 

Problem:

Input two numbers. If the first number is greater than the second, display First number is larger. Otherwise, display Second number is larger or equal.

Sample output screen

Enter first number: 25

Enter second number: 30

Second number is larger or equal


10. Freezing Check (freezing_check.py)

 

Problem:

Input a temperature. If it is below 0, display Freezing. Otherwise, display Not freezing.

Sample output screen

Enter temperature: -3

Freezing


11. Grade System (grade_system.py)

 

Problem:

Input a mark.

  • 80 and above → Grade A

  • 60 to 79 → Grade B

  • 40 to 59 → Grade C

  • below 40 → Fail

Sample output screen

Enter your mark: 67

Grade B


12. Traffic Light Meaning (traffic_light.py)

 

Problem:

Input a traffic light color.

  • red → Stop

  • yellow → Get ready

  • green → Go

  • anything else → Invalid color

Sample output screen

Enter traffic light color: yellow

Get ready


13. Number Sign (number_sign.py)

 

Problem:

Input a number.

  • greater than 0 → Positive

  • less than 0 → Negative

  • equal to 0 → Zero

Sample output screen

Enter a number: 0

Zero


14. Movie Ticket Price Category (ticket_category.py)

 

Problem:

Input age.

  • below 12 → Child ticket

  • 12 to 59 → Normal ticket

  • 60 and above → Senior ticket

 

Sample output screen

Enter age: 65

Senior ticket


15. Day Type (day_type.py)

 

Problem:

Input a day number from 1 to 7.

  • 1 to 5 → Weekday

  • 6 or 7 → Weekend

  • otherwise → Invalid day

Sample output screen

Enter day number: 6

Weekend


 

16. Exam Result with Distinction (exam_distinction.py)

 

Problem:

Input a mark.

If the mark is 50 or above, the student passes.

Then:

  • if the mark is 80 or above, display Pass with distinction

  • otherwise, display Pass

If below 50, display Fail

Sample output screen

Enter your mark: 84

Pass with distinction


17. Login Check (login_check.py)

 

Problem:

Input a username.

If the username is admin, then ask for password.

  • if password is 1234, display Login successful

  • otherwise, display Wrong password

If username is not admin, display Unknown user

Sample output screen

Enter username: admin

Enter password: 1234

Login successful



 

18. Scholarship Check (scholarship_check.py)

 

Problem:

Input a student’s mark.

If the mark is 60 or above, the student passes.

Then:

  • if the mark is 90 or above, display Scholarship candidate

  • otherwise, display Passed but no scholarship

If below 60, display Failed

Sample output screen

Enter mark: 75

Passed but no scholarship


19. ATM Withdrawal (atm_withdrawal.py)

 

Problem:

Input account balance and withdrawal amount.

If withdrawal amount is less than or equal to balance:

  • if withdrawal amount is less than or equal to 500000, display Withdrawal approved

  • otherwise, display Limit exceeded

Otherwise, display Insufficient balance

 

Sample output screen

Enter balance: 800000

Enter withdrawal amount: 600000

Limit exceeded


20. Club Membership (club_membership.py)

 

Problem:

Input age.

If age is 18 or above:

  • ask if the person has membership card

  • if yes, display Entry allowed

  • otherwise, display Membership card required

If under 18, display Too young to enter

 

Sample output screen

Enter age: 21

Do you have membership card (yes/no): no

Membership card required


 

21. Exam Pass by Two Conditions (exam_pass_conditions.py)

 

Problem:

Input exam mark and attendance percentage.

If mark is 50 or above and attendance is 75 or above, display Pass.

Otherwise, display Fail.

 

Sample output screen

Enter exam mark: 62

Enter attendance percentage: 80

Pass


22. Event Entry (event_entry.py)

 

Problem:

Input age and whether the person has a ticket.

If age is 18 or above and has a ticket, display Entry allowed.

Otherwise, display Entry denied.

 

Sample output screen

Enter age: 19

Do you have a ticket (yes/no): yes

Entry allowed


23. Weather Advice (weather_advice.py)

 

Problem:

Input whether it is raining and whether the person has an umbrella.

If it is raining and not carrying an umbrella, display You may get wet.

Else if it is raining and carrying an umbrella, display You are prepared.

Otherwise, display Weather is fine.

 

Sample output screen

Is it raining (yes/no): yes

Do you have an umbrella (yes/no): no

You may get wet



 

24. Password Strength (password_strength.py)

 

Problem:

Input a password.

Check these rules:

  • if length is less than 6, display Too short

  • else if password is admin or 123456, display Too weak

  • otherwise, display Acceptable password

 

Sample output screen

Enter password: 123456

Too weak


25. Smart Discount System (smart_discount.py)

 

Problem:

Input purchase amount and whether the customer is a member.

  • if purchase amount is 200000 or more and customer is a member, display 20% discount

  • else if purchase amount is 200000 or more or customer is a member, display 10% discount

  • else, display No discount

 

Sample output screen

Enter purchase amount: 150000

Are you a member (yes/no): yes

10% discount

Additional Decision Making Problems

Go to Top

26. Leap Year Check (leap_year_check.py)

 

Problem:

Input a year.

A year is a leap year if:

  • it is divisible by 400, or

  • it is divisible by 4 but not divisible by 100

Display Leap year or Not a leap year.

 

Sample output screen

Enter a year: 2024

Leap year


27. Triangle Type Checker (triangle_type.py)

 

Problem:

Input three side lengths of a triangle.

Check:

  • if all three sides are equal, display Equilateral triangle

  • if only two sides are equal, display Isosceles triangle

  • if all sides are different, display Scalene triangle

 

You may assume the inputs can form a valid triangle.

 

Sample output screen

Enter side 1: 5

Enter side 2: 5

Enter side 3: 8

Isosceles triangle


28. Simple Billing with Late Fee (late_fee_bill.py)

 

Problem:

Input the bill amount and the number of days late.

  • if the bill is not late, no extra charge

  • if late by 1 to 5 days, add 1000

  • if late by more than 5 days, add 3000

 

Display the final bill amount.

 

Sample output screen

Enter bill amount: 25000

Enter days late: 7

Final bill amount = 28000


29. Valid Username Check (username_check.py)

 

Problem:

Input a username.

A username is valid if:

  • its length is at least 6, and

  • it is not equal to admin, and

  • it does not contain a blank space

 

Display Valid username or Invalid username.

 

 

Sample output screen

Enter username: student01

Valid username


30. Delivery Charge System (delivery_charge.py)

 

Problem:

Input order amount and delivery distance in kilometers.

  • if order amount is 50000 or more, delivery is free

  • otherwise:

    • if distance is 3 km or less, delivery charge is 2000

    • if distance is more than 3 km, delivery charge is 4000

 

Display the delivery charge.

 

Sample output screen

Enter order amount: 32000

Enter delivery distance (km): 5

Delivery charge = 4000


31. Library Book Fine (library_fine.py)

 

Problem:

Input the number of days a book is overdue and whether the book is damaged (yes or no).

 

Rules:

  • if overdue days is 0, fine is 0

  • if overdue days is from 1 to 7, fine is 500 per day

  • if overdue days is more than 7, fine is 1000 per day

  • if the book is damaged, add an extra 5000

 

Display the total fine.

 

Sample output screen

Enter overdue days: 4

Is the book damaged (yes/no): yes

Total fine = 7000


32. Entrance Exam Result (entrance_exam.py)

 

Problem:

Input Math mark and English mark.

  • if both marks are 50 or above, display Accepted

  • if one mark is below 50 but both are at least 40, display Accepted with interview

  • otherwise, display Rejected

 

Sample output screen

Enter Math mark: 45

Enter English mark: 55

Accepted with interview


33. Electricity Bill Category (electricity_bill.py)

 

Problem:

Input the number of units used.

  • 0 to 100 units → Low usage

  • 101 to 300 units → Normal usage

  • above 300 units → High usage

 

Then:

  • if usage is high and units are above 500, also display Warning: very high consumption

 

Sample output screen

Enter units used: 540

High usage

Warning: very high consumption


34. Travel Permission Check (travel_permission.py)

 

Problem:

Input age and whether the person has a passport (yes or no).

 

Rules:

  • if the person has no passport, display Travel not allowed

  • otherwise:

    • if age is 18 or above, display Can travel alone

    • else display Needs adult companion

 

Sample output screen

Enter age: 15

Do you have a passport (yes/no): yes

Needs adult companion


35. Shop Promotion Decision (shop_promotion.py)

 

Problem:

Input the total amount spent and the number of items bought.

 

Rules:

  • if amount is 100000 or more and items are 3 or more, display Free gift and discount

  • else if amount is 100000 or more or items are 3 or more, display Discount only

  • otherwise, display No promotion

 

Sample output screen

Enter total amount spent: 120000

Enter number of items bought: 2

Discount only


Problem Set

Level (3)

Go to Top

36. Print Numbers from 1 to 10 (print_1_to_10.py)

 

Problem:

Write a program to display numbers from 1 to 10.

 

Sample Output:

1 2 3 4 5 6 7 8 9 10


37. Print Numbers from 1 to N (print_1_to_n.py)

 

Problem:

Input a number N. Display numbers from 1 to N.

 

Sample Output:

Enter N: 5

1 2 3 4 5


38. Print Even Numbers up to 20 (even_numbers.py)

 

Problem:

Write a program to display even numbers from 2 to 20.

 

Sample Output:

2 4 6 8 10 12 14 16 18 20


39. Print Numbers in Reverse (10 to 1) (reverse_numbers.py)

 

Problem:

Write a program to display numbers from 10 down to 1.

 

Sample Output:

10 9 8 7 6 5 4 3 2 1


40. Sum of Numbers from 1 to N (sum_1_to_n.py)

 

Problem:

Input a number N. Find and display the sum from 1 to N.

 

Sample Output:

Enter N: 5

Sum = 15


41.   Sum & Average (sum_average_5_numbers.py)

 

Problem:

Write a program to accept any 5 integers from the user.

Display the sum and average of the entered numbers.

Sample Output:

Enter number 1: 10

Enter number 2: 20

Enter number 3: 30

Enter number 4: 40

Enter number 5: 50

Sum = 150

Average = 30.0

 

42. Accept Integers Until 0 and Find Sum & Average (sum_average_until_zero.py)

 

Problem:

Write a program to accept integers from the user continuously.

Stop when the user enters 0.

Display the sum and average of the entered numbers (excluding 0).


Sample Output:

Enter number: 10

Enter number: 20

Enter number: 30

Enter number: 0

Sum = 60

Average = 20.0

 

43. Factorial of a Number (factorial.py)

Problem:

Write a program to input a positive integer N and calculate its factorial using a while loop.

 

👉 Factorial formula:

n! = n * (n-1) * (n-2) * ... * 1

5! = 5 * 4 * 3 * 2 * 1 = 120

 

Sample Output:

Enter a number: 5

Factorial = 120

 

Advanced Output:

Enter a number: 5

5!= 5 * 4 * 3 * 2 * 1 = 120

 

 

44. Find Maximum and Minimum of 10 Numbers (max_min_10_numbers.py)

Problem:

Write a program to accept 10 numbers from the user.

Find and display the maximum number and minimum number among them.


Sample Output:

Enter number 1: 15

Enter number 2: 8

Enter number 3: 23

Enter number 4: 4

Enter number 5: 17

Enter number 6: 9

Enter number 7: 30

Enter number 8: 12

Enter number 9: 6

Enter number 10: 20

 

Maximum = 30

Minimum = 4

 

45. Count Even and Odd Numbers of 10 Numbers (count_even_odd_10_numbers.py)

 

Problem:

Write a program to accept 10 numbers from the user.

Count and display how many numbers are even and how many are odd.

Enter number 1: 5

Enter number 2: 8

Enter number 3: 12

Enter number 4: 7

Enter number 5: 10

Enter number 6: 3

Enter number 7: 6

Enter number 8: 9

Enter number 9: 2

Enter number 10: 11

 

Even count = 5

Odd count = 5

 

Problem Set

Level (4)

46. Stop When Enter 0 (stop_at_zero.py)

 

Problem:

Keep asking the user to enter a number.

Stop the program when the user enters 0.

 

Sample Output:

Enter number: 5

You entered: 5

Enter number: 3

You entered: 3

Enter number: 0

Program ended


47. Continue with y/n (hello_repeat.py)

 

Problem:

Ask the user to enter their name and print a greeting.

Ask if they want to continue (y/n).

 

Sample Output:

Enter your name: Aung

Hello Aung

Continue? (y/n): y

Enter your name: Su

Hello Su

Continue? (y/n): n

Program ended


48. Even or Odd Repeater (even_odd_repeat.py)

 

Problem:

Ask the user for a number and print whether it is even or odd.

Repeat until the user chooses n.

 

Sample Output:

Enter number: 4

Even

Continue? (y/n): y

Enter number: 7

Odd

Continue? (y/n): n


49. Sum Until Stop (sum_until_zero.py)

 

Problem:

Keep asking numbers and calculate the total.

Stop when user enters 0.

 

Sample Output:

Enter number: 5

Enter number: 3

Enter number: 2

Enter number: 0

Total = 10


50. Multiplication Table (table_repeat.py)

 

Problem:

Ask the user for a number and display its multiplication table (1 to 5).

Ask if they want to continue.

 

Sample Output:

Enter number: 3

3 x 1 = 3

3 x 2 = 6

3 x 3 = 9

3 x 4 = 12

3 x 5 = 15

Continue? (y/n): n


51. Password Until Correct (password_loop.py)

 

Problem:

Keep asking the user to enter a password.

Stop only when the correct password (1234) is entered.

 

Sample Output:

Enter password: 1111

Wrong password

Enter password: 1234

Access granted


52. Count Positive Numbers (count_positive.py)

 

Problem:

Ask the user to enter numbers.

Count how many positive numbers are entered.

Stop when user enters 0.

 

Sample Output:

Enter number: 5

Enter number: -2

Enter number: 3

Enter number: 0

Positive count = 2


53. Guess the Number (guess_game.py)

 

Problem:

The program has a fixed number (e.g., 7).

Keep asking the user to guess until correct.

 

Sample Output:

Guess number: 3

Wrong

Guess number: 5

Wrong

Guess number: 7

Correct!


54. Simple Calculator Loop (calculator_menu.py)

 

Problem:

Create a menu:

1. Add

2. Subtract

3. Exit

Repeat until user chooses Exit.

 

Sample Output:

1. Add

2. Subtract

3. Exit

Choose: 1

Enter two numbers: 3 2

Result = 5

 

Choose: 3

Program ended


55. Find Maximum Number (find_max.py)

 

Problem:

Keep asking numbers and find the largest number.

Stop when user enters 0.

 

Sample Output:

Enter number: 5

Enter number: 9

Enter number: 3

Enter number: 0

Maximum = 9


56. Print Squares

 

(square_numbers.py)

Print square of numbers from 1 to 10.

 

Output:

1 4 9 16 …



57. Count Numbers Divisible by 3

 

(count_divisible_by_3.py)

Count how many numbers from 1 to 50 are divisible by 3.



58. Print Triangle 

 

(triangle_pattern.py)


Output:

Enter number: 5

*

**

***

****

*****


59. Reverse Triangle

 

(reverse_triangle.py)


Output:

Enter number: 5

*****

****

***

**

*