Lab task python practice questions exercises, Exercises of Programming Languages

Python is an object-Oriented programming language and these are practice exercise questions

Typology: Exercises

2019/2020

Uploaded on 06/26/2020

mehnoor-siddiqui
mehnoor-siddiqui 🇵🇰

1 document

1 / 19

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
LAB TASK NO#1
Problem#1
Write an algorithm and draw the flowchart for finding the average of two
numbers.
Algorithm:
Input: two numbers x and y
Output: average of x and y
Steps:
1. input x
2. input y
3. sum = x + y
4. average = sum /2
5. output average
START
Input x
Input y
Sum = x + y
Average = sum/2
Output
Average
END
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13

Partial preview of the text

Download Lab task python practice questions exercises and more Exercises Programming Languages in PDF only on Docsity!

LAB TASK NO#

Problem#

Write an algorithm and draw the flowchart for finding the average of two

numbers.

Algorithm: Input: two numbers x and y Output: average of x and y Steps:

  1. input x
  2. input y
  3. sum = x + y
  4. average = sum /
  5. output average START Input x Input y Sum = x + y Average = sum/ Output Average END

Average of two numbers:

CODE INPUT: CODE OUTPUT:

Problem#

Program that tells the person the year he/she will turn 100 years old.

CODE INPUT:

CODE OUTPUT:

Problem#

Printing the string in a specific format

CODE INPUT:

CODE OUTPUT:

Problem#

Write a Python program which accepts the radius of a circle from the

user and compute the area.

CODE INPUT:

CODE OUTPUT:

Problem#

Write a Python program which accepts the user's first and last name and print

them in reverse order with a space between them.

CODE INPUT:

CODE OUTPUT:

Problem#

CODE INPUT: CODE OUTPUT: FLOWCHART:

Programming exercise#

Start Input temperature in Degree Centigrade Fahrenheit=(Celsius*9/5) + Output Fahrenheit End

FLOWCHART: Start Input temperature in Fahrenheit Celsius=(Fahrenheit-32) *(5/9) Output Celsius End

Programming exercise#

Write a program to calculate the area of a rectangle.

CODE INPUT:

CODE OUTPUT:

Programming exercise#

4.Write a program to calculate the volume of a sphere.

CODE INPUT:

CODE OUTPUT:

FLOWCHART: Start Input radius Volume = (4/3)piradius** Output Volume End

FLOWCHART: Start Input Name low=myname.low() Print low upper=myname.upper() Print upper title=myname.title() Print title End