# ISY104 Input, Process and Output of Python Program: Activity Sheet Week 2 Assessment Answer # Objectives:

This week you will gain understanding about Input, process and output. How does a python program work from input to output and various functions that help you to write a basic python program? This week you also understand the concept of variables in your program and why are they important.

You also learn about various data types for your variables. In process part you learn about expressions and how operators are used in a python expression.

Activity – 1:

Draw a flowchart for a program to convert given kilometres to miles.

Activity – 2:

Write a pseudocode to display an area of a circle for a given radius.

Activity – 3:

Sales Prediction

A company has determined that its annual profit is typically 23 percent of total sales. Write a program that asks the user to enter the projected amount of total sales, and then displays the profit that will be made from that amount.

Hint: Use the value 0.23 to represent 23 percent.

Activity – 4:

Land Calculation

One acre of land is equivalent to 43,560 square feet. Write a program that asks the user to enter the total square feet in a tract of land and calculates the number of acres in the tract. Hint: Divide the amount entered by 43,560 to get the number of acres.

Activity – 5:

Total Purchase

A customer in a store is purchasing five items. Write a program that asks for the price of each item, and then displays the subtotal of the sale, the amount of sales tax, and the total. Assume the sales tax is 7 percent.

Activity – 6:

Sales Tax

Write a program that will ask the user to enter the amount of a purchase. The program should then compute the state and county sales tax. Assume the state sales tax is 5 percent and the county sales tax is 2.5 percent. The program should display the amount of the purchase, the state sales tax, the county sales tax, the total sales tax, and the total of the sale (which is the sum of the amount of purchase plus the total sales tax).

Hint: Use the value 0.025 to represent 2.5 percent, and 0.05 to represent 5 percent.

Activity – 7:

Work on the following expressions: 1. 8/4 + (2 -1) * 4

2. 6 + (10 -3) * 2/(1 + 1)

3. 5 + (12/6 + 3) * 3

Key Questions (You will work this out on your own, asking your tutor for help only when necessary):

Write down the answers to the following questions.

1. What are the three main building blocks of any python program?
2. If we want to have a variable for acct_bal (account balance) in a bank account what is the line of code to get the input of the starting balance in a bank account?
3. If saleprice = 93.90, then what is the data type of saleprice?
4. Write a small python program that will convert the given Celsius temperature to Fahrenheit. Fahrenheit = Celcius * 9/5 + 32
5. What is the result of the following expression? (15 + 3) / 3 * 1