Professional Documents
Culture Documents
CSE1001-Fall'20-Practice Problems 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
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:
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.
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