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

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