0% found this document useful (0 votes)
6 views2 pages

CSE101 - LAB4 Assignment

The document outlines a series of programming tasks for a CSE101 lab assignment focused on Python. Each task requires writing a program to perform specific input and output operations, such as reading integers and floating-point numbers, calculating sums and areas, and formatting strings. The document includes sample inputs and expected outputs for each task to guide students in their implementation.

Uploaded by

Fahmida
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views2 pages

CSE101 - LAB4 Assignment

The document outlines a series of programming tasks for a CSE101 lab assignment focused on Python. Each task requires writing a program to perform specific input and output operations, such as reading integers and floating-point numbers, calculating sums and areas, and formatting strings. The document includes sample inputs and expected outputs for each task to guide students in their implementation.

Uploaded by

Fahmida
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

CSE101

Introduction to Computer Science


Assignment - Lab 04
*Use a Prompt while taking Input*

Task 1: Write a python program that reads one integer from the user, and prints it back to show
which integer was entered by the user.
Sample Input: 5
Output: 5

Task 2: Write a python program that reads two integers from the user, and prints their sum,
product and difference.
Sample Input:
First number: 10
Second number: 5
Output:
Sum = 15
Product = 50
Difference = 5

Task 3: Repeat question 2 for two floating point numbers.


Sample Input:
First number: 10.5
Second number: 6.3
Output:
Sum = 16.8
Product = 66.14999999999999
Difference = 4.2

Task 4: Write a python program that reads the values of base and height of a triangle from the
user and prints its area.
Sample Input:
Base = 5
Height = 8
Output:
Area = 20.0

Task 5: Write a python program that reads five numbers from the user and prints their average.
Sample Input: 2 5 6 10 4
Output: Average = 5.4

Task 6: Write a python program that will read the first name and last name of a user and print
them in a reverse order (First, print the last name and then the first name in a single line with a
space between them).
Sample Input:
First Name: Tony
Last Name: Stark
Output:
Stark Tony

Task 7: Write a python program that will read the name of a user and the month he was born in
as inputs and print it in the following manner:
Sample Input:
Name: X
Month: June
Output:
X was born in June

You might also like