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

assignment 4_ACT

ICP assignment 4

Uploaded by

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

assignment 4_ACT

ICP assignment 4

Uploaded by

goutamsatpathy10
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Applied Computational Thinking (CSE 1401)

MINOR ASSIGNMENT - 4: Loop

1. Write a Python program to count down from a given number to 0 using a


while loop.
2. Write a Python program to print the multiplication table of a given
number.
3. Write a Python program that reverses a given string using a for loop.
4. Find the Largest Number in 5 user defined numbers using for and while.
5. Find the Length of a String using for loop.
6. Write a Python program that generates squares of numbers for up to nth
term using for loop.
7. Find the Second Largest Element in a sequence using for loop.
8. Print a diamond-shaped pattern using stars (*), where the number of
rows is n. The top half should be a pyramid, and the bottom half should
be an inverted pyramid.
*
***
*****
*******
*********
*******
*****
***
*
9. Write a Python program to remove all duplicate elements from a
sequence using a for loop.
10.Write a Python program to multiply corresponding elements of two
sequences and return the result in a new one.
11.Write a Python program to check if a given number is a palindrome
(reads the same forward and backward).
12.Find the Average of Numbers of user defined terms (Using for and
while both)
13.Write a Python program to check if a sequence is sorted in ascending
order (Using for and while both).
14.Print a square pattern of numbers, where each row has the same number
repeated.
11111
22222
33333
44444
15. Write a Python program to multiply two numbers without using the
multiplication operator (*). Use while loop.
16. Find the Smallest Multiple of 7 Greater than N using while loop.
17. Write a python program to find the sum of digits until the number
becomes a single digit
18. Write a python program to find the sum of odd digits in a number.
19. Write a Python program that generates and prints the first n rows of
Pascal’s Triangle, where n is provided by the user.
20. Write a program that generates the Fibonacci sequence up to a user-
defined number of terms.
21.Write a Python program that prints numbers from 1 to 20. However, if
the number is divisible by 5, it should skip that number using
continue. The program should break if the number is greater than 15.
22.Write a Python program that searches for a number in an array and
prints "Number Found" if the number is found. Use for…… else.
23.Write a Python program that continuously asks for a number from the
user. If the user enters a non-number (e.g., a string), use pass to skip
that input and ask again. If the user enters a valid number, the program
should break and display the number.

You might also like