Professional Documents
Culture Documents
School of Information Technology and Engineering
School of Information Technology and Engineering
Module -1
Problem Analysis Chart (PAC):
1. Write a PAC that inputs total capital and total liabilities and prints total
assets. assets=liabilities +capital, assets can also be calculated as
(alternate solutions) assets= 2*liabilities (or) assets =2*capital.
Solution:
2. Write an algorithm that takes sales for four quarters and then displays
total sales and average sales made.
Solution:
Step1: Read sales for four quarters (q1, q2, q3, q4)
Step 2: Compute the sum of q1, q2, q3 and q4
Step 3: Store this result in variable total_sales
Step 4: Print the value of total_sales
Step 5: Divide total_sales by 4
Step 6: Store the result in variable average_sales
Step 7: Print the value of average_sales
Step 8: End the program
3. Draw a flowchart to calculate the net salary after inputting basic salary,
hra%, da% and tax%. Net=basic+hra+da-tax.
Solution:
START
tax %
Tax= 100 × basic
da %
Da= 100 ×basic
hra %
Hra= 100 ×basic
Net=basic+tra+da+hra-tax
Print net
salary
END
4. Write a pseudocode to obtain principal amount, rate of interest and
time from the user and compute simple interest.
Solution:
Begin
Numeric rate, time, PA. SI, A
Display “Enter the rate of interest: ”
Accept rate
Display “Enter time period: ”
Accept time
Display “Enter principal amount: ”
Accept PA
Compute SI= PA*rate*time
Compute A= P+SI
Display “The simple interest is:” SI “and the final amount is: ”A
End
MODULE- 2
5. What is the output produced by following code ? a,b=bool(0),bool(0.0)
c,d=str(0),str(0.0) print(len(a),len(b)) print(len(c),len(d))?
Solution: A TypeError will be shown as bool does not have any length.
10.Write a program to take two inputs for day and month and then
calculate which day of the year the given date is. For simplicity, take 30
days for all months. For example, if you give input as Day 3 and month 2,
then it should print “Day of the year:33”. Use a function to perform the
calculation.
Solution: def day_of_year():
M = int(input("Enter the month number"))
D = int(input("Enter the day number"))
DY = (M - 1) * 30 + D
print("Day of the year", DY)
day_of_year()