Paper2 Final Notes 2023 Python
Paper2 Final Notes 2023 Python
2210
By Navid Saqib
• Analysis
• Design
• Coding
• Testing
• Maintenance
Analysis:
To solve a problem, it needs to be clearly defined or understood. So the person should
clearly know what should be developed as a solution. To study the system, we mostly use
abstraction and decomposition. Let’s understand them,
Abstraction:
means picking up only the right information for the solution and dropping all irrelevant
information, simplest example is when you provide information to a map application to go
to a specific place map application drops all other maps part and loads only the relevant
map to define routes.
Stages:
1. The first stage is to identify the purpose of the model of the situation that is to be built.
2. Use the information gathered from appropriate sources to identify what details need to
be included in the model and what should be removed
Decomposition:
This means dividing the main problem into small subproblems so that those subproblems
can be solved easily as individual one.
Design:
In the design stage, we create Pseudocode, flowcharts, structural charts, and layout screens
on the bases of the program specification obtained in the Analysis Stage. The design stage
decides what will be created in the shape of software.
Testing
The resulting program or set of programs repeatedly run with various test data sets. This
guarantees that every task carried out functions in accordance with how the software was
designed.
Each sub-system can be further broken down into even smaller sub-systems, and so on,
until each sub-system only does one action.
In decomposition stage, many simple problems some time become more complex than at
first sight.
Main
Level0 Program
Dividing the modules in 1.1, 1.2 subsections is also known as known as STEP WISE REFINEMENT or Top
Down Design
• inputs – the data used by the system that needs to be entered while the system is active
• processes – the tasks that need to be performed using the input data and any other
previously stored data
• outputs – information that needs to be displayed or printed for the users of the system
• storage – data that needs to be stored in files on an appropriate medium for use in the
future.
Pseudocode example
Knowing Pseudo-codes
Pseudo code:
Informal high-level description of a computer program or other algorithm, intended for human
reading rather than machine reading.
IDENTIFIER TABLE
Flowchart
What is a flowchart?
Elements of a flowchart:
Uses of a flowchart:
Another example:
Another example:
Another example:
Another example:
Pseudocode:
Q: Lengths of three sides of a triangle a, b, c are given as input. The following flowchart finds
if the triangle is isosceles, equilateral, or scalene. Some boxes in the flowchart are filled in for
you, fill in the rest of the details.
Hint:
Q: There are four types of fruits Apples, Oranges, Bananas and Grapes. Each student can pick
up two fruits. There are some conditions which have to be used to pick up the fruits. Draw a
flow chart which can take the name of first fruit as an input and print the names of second
fruit or fruits that can be picked up.
Hint: There will be one input box to read the first fruit, three decision boxes and four output
boxes in the flowchart.
Symbol1 :__________________
Purpose:
Symbol2 :__________________
Purpose:
Symbol3 :__________________
Purpose:
Symbol4 :__________________
Purpose:
Q:
1 2 3
Variables – (changeable values) which can change during the execution of the program
e.g
Constant – (static Values) which cannot change their values during the program
e.g
*In a program you can also create your own constant by declaring its value in the start
of the program
Num1 = 0
Here the variable of num1 has been declared this contains no initial value but it has to
be input by the user
Pseudo code:
DECLARE num1 : INTEGER
DECLARE num2 : INTEGER
Though it is said that python don’t require variables but the good practice is to define them
Local variable: Local variable can be accessed only in one module where it is stated.
Constants
PI = 3.142
Now the pihas been declared as a constant its value will remain static unless we don’t
change it by writing another programming statement
Pseudocode
CONSTANT PI = 3.142
After declaring the variable, it's time to assign it a value so that it can be used for further
processing. To assign a value to a variable, you must first display a valid user message to the
user, so he or she understands what type of input is required.
Pseudocode:
DECLARE NUM1 : INTEGER
OUTPUT “Input num 1”
INPUT num1
OUTPUT ”Input num 2”
INPUT num2
Displaying output is the one of the most important parts of a program. A program will be
useless until and unless output is not properly displayed.
• To output the value of a variable “,” is used right after the end of user message
• This ”,” is known as which separate the User message with value of variable.
Output will be
pseudocode:
OUTPUT “Num1 given is : ”, num1
This stage has a very important role in a program. Most probably it is the most complex stage in
programming language.
All the other three stages can be done in this stage as well
• Such as you can declare a new variable in this stage.
• You can ask for an input from user.
• Show him the output and do the processing.
• Addition
• Subtraction
• Division
• Multiply
2. Relational/Comparison operators
A>=40,B<10,C<> 1
3. Logical Operators
Operator VB code
AND And
OR Or
NOT Not
NOT(0) = 1
NOT(1) = 0
Examples OF AND, OR
OR
Totaling:
Let’s make a situation. Today is your birthday and you being very excited about how many
Birthday presents would you receive.
Now let’s make a Visual basic code for the total number of gifts you would receive.
Increment
Let’s make another situation for increment. Suppose you have $150 in your wallet. You receive
$20 more from your father. Then your friend came and returns you your $5 you have lent him
last week. Now you would ask your brother for money and you don’t know how many he would
give you.
Now let’s make a pseudo code and visual basic code for your total increment to your wallet.
Pseudo code:
Decrement
Suppose you have $200 in your wallet. You went to a store and bought some vegetables and
fruits for $20. Then you pay a debt of $100 to a bank. Your child has said that he would be
requiring some money for his school assignment. At the end of the day how many you have left
with??? Let’s make a Visual basic code and Pseudo code for this situation.
Pseudo code :
Python code:
Count = count + 1
A Nursing home of orphanage has 10 kids to support. Nursing staff has to give lunch box to all
those kids who are less than 10 of age and pocket money to those who are more than 10 in
age.
PSEUDOCODE :
FOR child = 0 to 3
IF age > 10
THEN
upperage = upperage + 1
ELSE
lowerage = lowerage + 1
ENDIF
ENDFOR
Selection:
There are two types of selection statements If and Case, where if statement has three
categories.
IF Condition THEN
Task
ENDIF
Pseudo code
This statement is used only when students have to deal with one condition such as
Here IF the value entered in num1 is lesser than 0 then “Negative” will be displayed.
More Examples:
PSEUDO CODE:
IF Data = 10
THEN
ENDIF
IF Data = 20
THEN
OUTPUT”Exactly equals to 20 ”
ENDIF
IF Data < 0
THEN
OUTPUT”less than 0”
ENDIF
python CODE:
Another example:
PSEUDOCODE:
THEN
ENDIF
IF age > 10
THEN
ENDIF
IF age < 10
THEN
ENDIF
python code:
b) IF….THEN….ELSE….ENDIF (Two-way)
IF Condition THEN
Task1
ELSE
Task2
ENDIF
Nesting : using IF then statement inside the IF than statement, if you have 3 conditions 2 of it will be
used in positive part and 1 will be used in else portion
IF Condition 1 THEN
IF Condition 2 THEN
Task1
ELSE
Task2
ENDIF
ELSE
Task3
ENDIF
Pseudocode:
IF num1 > 0
THEN
IF num1 = 0
THEN
ENDIF
IF num1 > 0
THEN
OUTPUT”Positive”
ENDIF
ELSE
OUTPUT”Negative ”
ENDIF
This statement is used when students have to deal with 2 conditions such as
Is a nested if, true
portion contain
two single if
blocks. Stating if
value is >0 again
where value is
equal to zero then
first task will run
otherwise second
task is run
Module Module1
Dim num As Integer
Sub Main()
Console.Write("Enter a Number : ")
num = Console.ReadLine()
Module Module1
Sub Main()
Dim alphabet, c As Char
Console.Write("Enter a Alphabet : ")
alphabet = Console.ReadLine()
c = UCase(alphabet)
If c = "A" Or c = "E" Or c = "I" Or c = "O" Or c = "U" Then
IF Condition 1 THEN
Task1
Task2
Task3
Task4
ELSE
Error
ENDIF
Pseudo code:
ENDIF
ENDIF
This statement is used when students have to deal with more than 2 or multiple conditions, you
can cater error in else or you can directly deal condition in elseif such as
Another example of multiple if (Grading System in a school) GRADES ARE MOSTLY DONE ON
MARKS
IF percentage >= 90
THEN
grade = "A*"
ELSEIF percentage >80 and percentage < 90
THEN
grade = "A"
ELSEIF percentage > 70 and percentage < 80
THEN
grade = "B"
ELSEIF percentage > 60 and percentage < 70
THEN
grade = "C"
ELSEIF percentage > 50 and percentage < 60
THEN
grade = "D"
ELSE
grade = "FAIL"
ENDIF
OUTPUT "Student name is : ", name , " " , "His percentage is : ", percentage , " " , "and
their grade is : ", grade
python code:
CASE STATEMENT
It is alternative selections construct like IF statement. First the variable has to be declared upon
which case has to be applied. There are 3 ways to write a CASE construct.
Pseudo code:
DECLARE grade : STRING
grade = INPUT “Input student grade”
Case of grade
“A” : OUTPUT ”Top grade”
“F”, “U” : OUTPUT ”FAIL”
“B” to “E” : OUTPUT ”Pass”
OTHERWISE
OUTPUT “ Invalid grade”
END CASE
python code:
Single value
Single value
separated by comma
Range
Another example
Pseudo code
CASE OF choice
Note* : if you want you can Add case else to state the error option in it
CASE OF choice
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
Another example:
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
Nesting of IF statements
Nesting is used in programming whenever multiple categories has to be described under one
or more options for example
Pseudocode: here in positive range EXACTLY EQUALS TO ZERO and other POSISTIVE
INTERGERS force us to do nesting
• Small
• Medium
• Large
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
ITERATION
Iteration is another name for LOOPS. There are 3 types of iteration
Conditional Loops
This iteration is used when numbers of turns or loops are known. Variable which is used for
loop is incremented inside the loop so that loop performs the fixed number of turns and it
executes the loop until given value is reached.
Pseudo code:
Case of grade
“A” : OUTPUT ”Top grade”
“F”, “U” : OUTPUT ”FAIL”
“B” to “E” : OUTPUT ”Pass”
OTHERWISE
OUTPUT “ Invalid grade”
END CASE
END FOR
Step OPTION is used to divide a larger loop into equal smaller divisions. Can run in negative as
well
End of FOR TO
NEXT loop
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
Here the code will ask to input the speed of 10 cars and check them against limit speed and will
fine them if their speed exceeds speed limit.
Pseudo code
FOR count = 1 to 10
speed = INPUT”input car speed”
ENDFOR
Python code:
Change in situation: Company wants to know how many out of 10 cars have issued challan.
Defining of Counting
Variable
Counter has to be
placed where challan
has to issued
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
As the name suggests, this loops executes the statement, evaluates it and then compare it with
the given condition. As long as the condition is FALSE the loop is executed again and again and
loop ends as the condition is satisfied.
Pseudo code:
Python code :
Here values less than 0 and greater than 100 are shown as invalid marks and value between 0
and 100 is displayed as valid marks.
And other example: This code is written to output the error until the user inputs the valid
number of quantities to be bought. (Greater than 5 but less than 15)
Pseudo code:
python code:
This loop evaluates the condition before the statements within the loop are executed. Pre-
condition loops will execute the statements within the loop as long as the condition evaluates
to True. When the condition evaluates to False, execution will go to the next statement after
the loop
Verification
is a process in a manual written data is compared with typed data or with computer file to decide that
data inputted in correct.
Range Checks: defining a particular range so the input value should be restricted to that by using 2 steps
Pseudo code:
ENDWHILE
• Marks greater than 100 and smaller than 0 are rejected with a user message “input
invalid marks”
Example 2
Pseudocode:
Python code: Another way of validation. Whenever you want to validate marks or numeric
values always use While……..Endwhile
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
Test1 Marks
are validated
from 0 to 25
Test2 Marks
are validated
from 0 to 35
Test3 Marks
are validated
from 0 to 45
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
length checks: is restricting to particular characters, say that a password must be exactly eight
characters in length so that passwords with seven or fewer characters or nine or more characters would
be rejected.
INPUT Password
IF LENGTH(Password) <> 8 THEN
OUTPUT "Your password must be exactly eight characters, please re-enter "
ENDIF
UNTIL LENGTH(Password) = 8
INPUT FamilyName
THEN
ENDIF
UNTIL LENGTH(FamilyName) <= 30 AND LENGTH(FamilyName) >= 2
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
Presence check :
A presence check checks to ensure that some data has been entered and the value has not been left
blank, for example, an email address for an online transaction must be completed.
python Code:
Format check :
A format check checks to ensure that some data in a specific format has been entered, for example, an
ABC1234.
python program: this program refers to STRING MANIPULATION refer to that section first
More Questions:
Presence check
format check
range check
Q: Develop this code in vb and test it by providing different values. Then Dry run it
Verification is the process of making sure that information is accurately copied from one source
to another, such as when it is entered into a computer or transferred from one portion of a
computer system to another.
Data is entered twice for double entry, sometimes by different operators. When the computer
system compares the two entries, it generates an error message requesting that the data be
entered again.
A SCREEN/VISUAL CHECK is a manual check completed by the data entry user. When all of the
data has been entered, it is displayed on the screen, and the user is asked to confirm that it is
correct before proceeding.
• Normal data
• Abnormal data
• Extreme/boundary data
Normal Data: are the valid ranges for example a valid range for a QTY field is 0 to 40 specified by the
business, so that will be considered as a valid data range.
Abnormal Data: are the invalid range like in Qty field less than 0 and greater than 40 are the invalid
ranges.
Extreme/Boundary Data: 0 and 40 will be considered as the boundary range or the extreme range.
Dataset: 56,-18,0,40
A←0
B←0
C ← 100
OUTPUT "Enter your ten values"
REPEAT
INPUT X
IF X > B
THEN
B←X
ENDIF
IF X < C
THEN
C←X
ENDIF
A←A+1
UNTIL A = 10
OUTPUT B, C
Hint use dry run method to solve it and even can find error if it is there
Products
Maize
Wheat
Biscuits
Oil
Eggs
Here the Product is the name of Array and its data type is declared as STRING
In setting and declaring the lower and upper bounds has to be declared, which means that how
many data is to be stored in a single array
In Next Page
This is piece of code will ask for marks of 5 students in 3 subjects then it will calculate their
total, average and display them
OUTPUT ”student name ”, name[Y], “ ”, “And total marks are ”,total[Y], “ ”, “average marks
”,avgm[Y]
ENDFOR
NOTE: Every
array is
written with
accordance to
the FOR
LOOP in
which it’s Second loop is being run in accordance with
being run Y to display the output
Test the give code and annotate the python code by adding ‘ to first line
‘setting and declaration
• Buying multiple fruits from market stating its quantity and price and calculate its total
• Buying multiple grocery items from market stating its quantity and price and calculate
its total
• Buying multiple cinema tickets for different movies stating its quantity and price and
calculate its total
Pseudo code:
python code:
FOR X = 1 to 3
INPUT " input marks in test 1", marks1[X]
INPUT " input marks in test 2", marks2[X]
INPUT " input marks in test 3", marks3[X]
total[X] = marks1[X] + marks2[X] + marks3[X]
NEXT
FOR A = 1 to 3
IF total[A] < min
THEN
min = total[A]
ENDIF
NEXT
OUTPUT"minimum marks are :", min
FOR Y = 1 to 3
OUTPUT"total is : ",total[Y]
NEXT
The same case is with the maximum numbers we just change the lesser than sign “<” with
greater than sign”>” and declare the maximum variable = 0
Now we will calculate the total of the whole class and calculate its average from the previous
code.
Average being
calculated outside
the loop
Linear search is a process of comparing a search item with every individual item of the array,
same we have a numeric item to be searched in an array of multiple numbers.
Search item
4 NUM
12
38
2
5
Pseudocode:
Problem1: the code won’t show any result if I enter 6 actually which is not in the list ,code
won’t show any answer
Solution1: use a Boolean variable to check the found or not found status if not found in list it
will show data not found in list.
Problem2: say if I have 1000 items in an array showing 9999 items as not found and one item as
found is cumbersome to find one single entry of found in it
Solution2: remove else portion in the code to remove unnecessary not found repetition.
Here is the python code read it carefully Test it in visual studio and then write its pseudocode
to this
Bubble Sort:
Bubble sorting is a process of sorting data Alphabetically in ascending or in descending order, either data
in numbers or in alphabets
Process involved checking first two data elements of array if first element is greater swap will take place
otherwise it moves to second and third element of array and then carry one.
12 12 5
5 12 5
5 12 12
Pseudocode:
DECLARE NUM:ARRAY[1:3] OF INTEGER
DECLARE TEMP : INETGER
//INPUT 3 DATA ELEMENTS
FOR X← 1 TO 3
INPUT “ENTER NUMBER: “,NUM[X]
ENDFOR
OUTPUT “ “
OUTPUT “unsorted list”
FOR A ←1 TO 3
OUTPUT NUM[A]
ENDFOR
OUTPUT “ “
For E ← 1 To 3
For C = 1 To 2 - 1
IF num[C] > num[C + 1] Then
TEMP ← num[C]
num[C] ← num[C + 1]
num[C + 1] = TEMP
End If
Next
Next
OUTPUT “ “
OUTPUT "Sorted list"
For y ← 1 To 2
OUTPUT num[y]
EMDFOR
Apply this code in python and see its working: Another Example of bubble sort
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
2D Array
In 1d array we created 4 different arrays to handle four elements like product name, qty, price,
total respectively
0 1 2 3
0 Maize 2 3 6
1 Wheat 3 1 3
2 Biscuits 4 2 8
3 Oil 6 2 12
4 Eggs 7 1 7
0 1 2 3
0 0,0 0,1 0,2 0,3
1 1,0 1,1 1,2 1,3
2 2,0 2,1 2,2 2,3
3 3,0 3,1 3,2 3,3
4 4,0 4,1 4,2 4,3
These locations will help us to assign data to them e.g if I wanna assign data maize to 0,0 I will
do it like that Data[0,0] ← “Maize”
FOR R ← 1 to 5
For C ← 1 to 3
INPUT “ENTER DATA : “,DATA[R,C]
ENDFOR
ENDFOR
FOR ROW ← 1 TO 5
ENDFOR
FOR X ← 1 to 5
For Y ← 1 to 4
OUTPUT DATA[X,Y], “ “
ENDFOR
OUTPUT “ “
ENDFOR
python code:
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
Question : input data of 5 student name test1, test2, test3, and calculate total and avg marks
using 2D array and display Student name, test1 , test2, test3, total, avgmarks.
Or
is a set of programming statements grouped together under a single name that can be called to perform
a task at any point in a program.
Pseudocode:
python code: addition is a procedure in which two values where forwarded 10 to p1 and 5 to p2, than
total is calculated and out is produced, so rather than main program another block will perform addition
on the behalf of main code call.
Parameters: are the variables that store the values of the arguments passed to a procedure or
function. Some but not all procedures and functions will have parameters e.g p1 : INTEGER, p2 :
INTEGER are the two parameters
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
Functions: are the separate block of code which perform a task on the call given by the main code, it
does have a capability to return back any value or update any value in main program. Rather than
producing output it silently got o main code and store its result in it variable. Rather than call we use
assignment it to a variable.
Description : in this code all functions will calculate and return total value to different variables in main
program and main program will output the received values at any time.
Pseudocode:
FUNCTION Addition(p1 : INTEGER, p2 : INTEGER) RETURN INTEGER
DECLARE TOTAL : INTEGER
TOTAL ← P1+P2
RETURN TOTAL
END FUNCTION
Python code:
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
Problem : your teacher provide you a formula sheet and tell you to create functions for every individual
formula and integrate it in a full program
A global variable can be used by any part of a program – its scope covers the whole program.
A local variable can only be used by the part of the program it has been declared in – its scope is
restricted to that part of the program.
Psudocode:
Files handling
Till yet we are saving all our work in variables, constants, arrays temporarily when we turn off
our computer all saved work in memory is vanished away. To save them permanently we need
to stop it on hard disk drive.
Types of files
Frontend: contain applications programs which run to complete a particular task for the user
Backend: contains hardware controlled by kernel, all device drivers are stored in it. Its kernel
responsibility to kept it optimized in all mean.
API: a set of functions and procedures allowing the creation of applications that access the
features or data of an operating system, application, or other service. It works like a bridge
between front end and back end.
Kernel Hardware’s
variable API
User
Kernel Hardware’s
variable API
User
Kernel Hardware’s
variable API
User
Writing code:
Reading code :
Appending code:
Pseudocode :
// writing
FILEMANAGER ← “MINE.TXT”
WRITE(DATA)
CLOSE FILEMANGER
// READING
FILEMANAGER1 ← “MINE.TXT”
DATA ←READ(FILEMANAGER1)
CLOSE FILEMANGER1
// APPENDING
FILEMANAGER2 ← “MINE.TXT”
WRITE(DATA2)
CLOSE FILEMANGER2
Knowing Database
Database: is a collection of raw data arranged in shape of fields, records tables. Can be obtain
through putting a criteria based on query to search the Information out of these tables
Relationship:
One to Many: this type of relationship exist it 98% databases. For example
Alternate can be Many cars are owned by one owner example of MANY TO ONE
35302-2414271-5
Q: create a table on student Entity in MS Access and feed at least 10 records in it use these
fields
• Studentid
• StudentName
• FatherName
• DOB
• Gender
• Address
• Telephone
• Mobile
• City
• Province
• Country
Q: Narrate 5 Examples of ONE TO MANY and ONE TO ONE relationship and discuss it with
teacher.
Q: create Two tables on Customer and orders Entity in MS Access and feed at least 10 records
in it use these fields
• Customerid • paymentid
• CustomerName • paymentdate
• FatherName • Amount
• DOB • Paymentmode
• Gender • Bank
• NIC# • Cheque#
• Address • Status
• Telephone
• Mobile
• City
• Province
• Country
Validation in database
Length Check
Presence Check
Queries:
Query Based
example Grid
Query by example grid where you include fields in grid and set criteria on it as shown in image
Query by example can contain multiple elements in it like criteria , sorting , from which table it
is , field name, should it be displayed or not.
Criteria to search
Sorting based on
owner field
Data shown in
Result : Ascending order of
owner
Text/String based
“Volvo” Find exact match of Volvo
“V*” Result should start with V
“*o” Result Should End with o
“*e*” Result should contain e in it
Number/Integer based
8 Find exact match of 8
>5 Result all values more than 5
>=10 Result all values more than equal to 10
>=5 And <=10 Result should be greater than and equal
to 10 only moth inclusive
There are two sections of it Data Definition Language DDL used to create tables and fields.
Where as the other section is DML data manipulation language which will search data out of
the table based on given conditions, we will cover only DML here as per our syllabus
This line state that the fields selected out of the table is name, date of birth, gender, town
SELECT *
FROM crooks
Description: select all fields from crook table and show only those records where name equal to
jane.
SELECT SUM(numScars)
SELECT COUNT(numScars)
result : 6 Means total numberof count will be displayed.
Logic Gates
Pseudocode
practice Book-let
for X in range(2):
print("input product name")
name[X] = input()
print("enter quantity")
qty[X] = int(input())
print("There are only four categories: A, B, C,
D")
print("enter category")
category[X] = input()
if category[X] == "A":
price[X] = 150
elif category[X] == "B":
price[X] = 250
elif category[X] == "C":
price[X] = 350
elif category[X] == "D":
price[X] = 450
for Y in range(2):
print("Product name :", name[Y], "\tquantity
:", qty[Y], "\tCategory is :", category[Y], "\tyour
total is", total[Y])
for x in range(len(data)):
if data[x] > max_value:
max_value = data[x]
name = [""] * 5
test1 = [0] * 5
test2 = [0] * 5
test3 = [0] * 5
avg = [0] * 5
for X in range(5):
print("Input name:")
name[X] = input()
print("Input marks for test 1:")
test1[X] = int(input())
print("Input marks for test 2:")
test2[X] = int(input())
print("Input marks for test 3:")
test3[X] = int(input())
avg[X] = (test1[X] + test2[X] + test3[X]) / 3
for Y in range(5):
print("Name of student:", name[Y], "Test 1
marks:", test1[Y], "Test 2 marks:", test2[Y], "Test
3 marks:", test3[Y], "Average marks:", avg[Y])
price = [0, 0]
qty = [0, 0]
total = [0, 0]
tvalue = [0, 0]
gtotal = [0, 0]
pname = ["", ""]
for X in range(2):
print("input product name")
pname[X] = input()
print("input quantity")
qty[X] = int(input())
print("input price")
price[X] = int(input())
for Y in range(2):
print("product name is :", pname[Y], "quantity
is :", qty[Y], "tax value is :", tvalue[Y], "gross bill
is :", gtotal[Y])
names = [""] * 2
marks = [0] * 2
for x in range(2):
print("Input name:")
names[x] = input()
print("Input marks:")
marks[x] = int(input())
for y in range(2):
print("Student names:", names[y], "their
marks are:", marks[y])
product = [""] * 2
qty = [0] * 2
price = [0] * 2
total = [0] * 2
for X in range(2):
print("Input product name ")
product[X] = input()
print("Enter price")
price[X] = int(input())
print("Input quantity")
qty[X] = int(input())
for Y in range(2):
print("Product name:", product[Y], "price is:",
price[Y], "quantity is:", qty[Y], "total is:",
total[Y])
noplate = [0] * 2
speed = [0] * 2
fine = [0] * 2
for X in range(2):
print("input cars number plate:")
noplate[X] = int(input())
for Y in range(2):
print("Your car number is:", noplate[Y], "your
speed was:", speed[Y], "You have to pay this
amount as a fine:", fine[Y])
names = [None] * 10
for X in range(10):
print("Enter student names:")
names[X] = input()
for Y in range(10):
print("Students names are:", names[Y])
data[0][0] = "id"
data[0][1] = "Name"
data[0][2] = "Price"
data[0][3] = "Quantity"
data[0][4] = "Total"
for X in range(4):
for Y in range(5):
print(data[X][Y], end="\t")
print("")
They serve three type of pizza to their dine-in customer’s details of pizza’s are given below
Owner of the company want you to design a POS for his business. Software should possess these
features.
Qno3 Write a pseudocode for a moven ice cream parlor van. Moven Ice-cream parlor van
serves his customers ice-cream cones with only one or two scoops not more than that. Moven
icecream has 3 flavor to serve to his customers which are
• Choc
• Praline
• Tuttifruiti
Qno 4 Given the sides of a parallelogram, write an algorithm to determine its type. Structured English
solution is given. Write its Pseudocode.
Begin
Read base
Read height
End
Pseudocode here:
Qno 4. Ask a user for their eye color as input, if they say green then call them a "Goblin", else “you
must be a different type of monster”. write its pseudocode
Begin
Read Eyes
End
Qno5 A School want to create a program which Ask student regarding its age and decide he/she is in
secondary school or not. Study the snapshots carefully and construct the pseudocode.
Begin
Read Feel
Read Exercise
If feel = "Sad"AND exercise = "No"Then
Write "Go for a walk, you might feel better"
otherwise
write"Sorry I don't know how to help"
EndIf
End
Using one IF statement write code to handle the above:
Qno7: In Britain a driving rule is that society members that if they are equal more than 21 years of age
and they are drunk they are not allowed to hire the car for driving. If they are not drunk, they can drive
it.
A program code is generated in python but few chunks are missing. Complete it and regenerate the
program its pseudocode
Qno8: Metro Pvt ltd has decided to facilitate his customers by providing a Vandering machine in
the mall
• Coke
• Pepsi
• Fanta
• 7UP
Kid has to insert 20 Rs currency note in machine. System has to check the validity that it’s a
valid 20 Rs currency note then it ask for the choice of drink and on selection it drops the Drink
can in tunnel.
Where as :
Enter username
Jonny5
RECOGNISED! Enter password:
Alive
Please enter Jonny5
If they get the username wrong it should immediately kick them out and not ask for the password. If
they get the password wrong it should kick them out.
Create its pseudocode:
Case Statements:
Qno10 an incomplete code is presented. Read it carefully and correct it than write its
pseudocode
Qno11 Read this python code and explain the purpose of these lines
number = 5
Line1 ____________________________________________________________________
Line 2____________________________________________________________________
Line 3____________________________________________________________________
Line 5____________________________________________________________________
Line 12___________________________________________________________________
Line 14___________________________________________________________________
Qno12 Create a program where someone types in the name of an animal and it outputs the
sound the animal makes in shape of text. The animals it should handle are:
• Horse - Eehehehe
• Cow - Moo
• Bear - Grr
• Sheep - Baa
• Tiger - Grr
everything else - Meow
Try and complete this task by only using 5 case statements. Write its pseudocode
Qno12 you are now going to use a case statement to create an ELECTRONIC PIANO.
Solution:
Qno 13 Pizza hut company offer custom pizzas coming direct from HOT Oven as per the
requirements if customer. Company offers 3 types of pizzas to the customer mentioned below
Instruction: Use Nested Select case, don’t use if then else end if statement.
pseudocode here
Qno14 Café 44 decided to serve drinks through automated robot like a Bar tender. But machine
requires age verification
if customer is more the 18 year he/she can order these drinks
• Margarita 150 rs
• Pinna Colada 200 rs
• Pine Shake 300 rs
• Blended cocktail 450 rs
• Water 40 rs
Whereas those who are under the age of 18 can order only these
• Coke 25rs
• Milk Shake 30rs
• Water 20rs
• Red bull 80rs
Note* Use appropriate lay out of bill on your own and declare any price for the drink
Iteration/Loops practice:
QUESTION NO 1
Write a python code. First input student name then input his/her marks in 2 tests
Make sure that invalid marks entered would be rejected. Calculate their average and total.
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
QUESTION NO 2
Write a python code. Ask for 10 positive numbers and find the smallest and largest number
between them.
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
QUESTION NO 3
Input 10 positive numbers and find min and max out of it and calculate their total.
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
QUESTION NO 4
Write a pseudocode. Input the names of 10 vegetables, input their price and calculate total
by multiplying it with quantity (using WHILE and FOR Loops only ).
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
Iteration/Loops practice2:
Question no 1
Input the username and password, if username and password is empty it should reenter both.
Also known as validation if username and password match it should display “Access allowed”
otherwise it should display “Access Denied”
*DO THIS QUESTION USNIG BOTH REPEAT UNTILL AND WHILE LOOPS.
Username = Franklin , Password = 11237
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
Question no 2
Input the marks of 10 students in 3 tests, apply validation on test1, test2, test3 out of 20, 25
and 30 respectively. Calculate its Total and avgmarks, make sure that all the invalid entries are
rejected with an error statement. Display grand total (Sum of all the marks) and average of the
whole class.
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
Question no 3
Input the names 10 of late coming students and fine them according to this table.
Time Fine
Less 10 minutes 100
Greater than 10 less than 25 minutes 150
Greater than 25 less than 40 minutes 250
More than 40 minutes 300
Calculate the total fine collected at the end of the day
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
1D Array practice:
Q no2: Define 2 one dimensional arrays to obtain names of student and their obtain marks and
display both in lists output showing names and their obtain marks.
Q no3: Define 3 one dimensional array to obtain Product Names, Quantity and Price, and
calculate the total by multiplying the quantity with the price
Using last question code adjust it to find the maximum and minimum quantity required and
calculate the grand total
Qno5: School wants to record the weight of 80 students when they got admission in school.
And at end of every year their weight will be recorded. So that the difference will be forwarded
to the nutritionist maintain class health chart.
Question no 6
Write a code for National Traffic Department. In this code first input the number of 5 cars
(using an array), then according to the cars input their speed. IF their speed is exceeding
150km/h then fine that specific car.
Question no 7
Using array write a python code, this inputs the angle of 3 corners. IF the angle is smaller than
90 then output, it’s a acute angle else if angle is greater than 90 but smaller than 180 then
output it’s a obtuse angle and if angle is greater than 180 but smaller than 360 then output it’s
an reflex angle.
Question no 8
The code you have written on question 3, made amendments to it, now add tax to the total
value. If $150<total value > $500 then tax it 10%
QUESTION NO 9
Write a python code for a transport company. First ask the name of 2 customer store it in a
variable (USING AN ARRAY). Secondly ask how many seats they want. Then ask the distance
they want to travel. IF distance = 2, 3, 4 then price of 1 seat is 20 RS, IF distance = 5, 6, 7 then
price per seat = 30 RS, IF distance = 8, 9, 10 then price of one seat = 40RS ELSE IF distance > 10
then price per seat = 45RS
OUTPUT