You are on page 1of 3

CSE1001-Fall'20-Practice Problems 3

1.

Age in Seconds
Houseflies have an approximate life of four weeks. Given the number of days a
housefly lived, design an algorithm and write the Python code to determine its
approximate age in seconds. Check for boundary conditions and print ‘Invalid input’
if condition is not satisfied. For example, if a housefly lived for 21 days then its
approximate age in seconds is 21*24*60*60 is 1814400.

Input Format

Number of days, n

Output Format

Number of seconds

Boundary Conditions

n>0 and n <28

2.

Pattern 2
Given ‘n’, the number of rows, design an algorithm and write a Python code to draw
a pattern. If n is ‘5’, the pattern looks as shown below:

**

***

****

*****

3.

Arithmetic Expression
Write a python script to read a number from the user, find the difference between
the sum of squares up to that number and the number itself. 
Input:

Number

Output:

Difference between the sum of squares up to that number and itself. 

For example if a number is 3, then output will be 11 ( i.e 1 2 + 2 2 + 3 2   - 3 = 11)

4.

Multiples of a number
Write a Python Script to find the multiples of a given number up to a specific range.

Input:

Number

range

Output:

Multiples of a number.

For example, if a Number is 5 and range is '3' , the output is 5 10 15

if a number is 3 and range is '4', the output is 3 6 9 12

5.

Number of Words
A Student is curious about to find the number words in a book. While he started
reading the book, he observed that the author has restricted18 lines per page. Each
line should contain a maximum of 15 words. Write a python script to find the number
of words in a book.

Input:

Number of Pages

Output:

Number of Words

You might also like