0% found this document useful (0 votes)
10 views8 pages

100 While Loop Programs

The document contains a comprehensive list of programming tasks that involve writing Python programs using while loops. Each task focuses on different concepts such as printing sequences, calculating sums, checking number properties, and manipulating strings and collections. The tasks range from simple to complex, covering various programming fundamentals.

Uploaded by

hhgbnh
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)
10 views8 pages

100 While Loop Programs

The document contains a comprehensive list of programming tasks that involve writing Python programs using while loops. Each task focuses on different concepts such as printing sequences, calculating sums, checking number properties, and manipulating strings and collections. The tasks range from simple to complex, covering various programming fundamentals.

Uploaded by

hhgbnh
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

Q1.

Write a program to print the following using while loop


First 10 Even numbers

[Link] 10 Odd numbers

Q3. First 10 Natural numbers

Q4. First 10 Whole numbers


Q5. Write a program to print first 10 integers and their squares using while loop.

Q6. Write while loop statement to print the following series: 10, 20, 30 … … 300

Q7. Write a while loop statement to print the following series 105, 98, 91 ………7.

Q8. Write a program to print the first 10 natural number in reverse order using while loop.

Q9. Write a program to print sum of first 10 Natural numbers.

Q10. Write a program to print sum of first 10 Even numbers.

Q11. Write a program to print table of a number entered from the user.

Q12. Write a program to print all even numbers that falls between two numbers (exclusive
both numbers) entered from the user using while loop.

Q13. Write a program to check whether a number is prime or not using while loop.

Q14. Write a program to find the sum of the digits of a number accepted from the user.

Q15. Write a program to find the product of the digits of a number accepted from the user.

Q16. Write a program to reverse the number accepted from user using while loop.

Q17. Write a program to display the number names of the digits of a number entered by
user, for example if the number is 231 then output should be Two Three One

Q18. Write a program to print the Fibonacci series till n terms (Accept n from user) using
while loop.
Q19. Write a program to print the factorial of a number accepted from user.

Q20. Write a program to check whether a number is Armstrong or not. (Armstrong number is
a number that is equal to the sum of cubes of its digits for example : 153 = 1^3 + 5^3 + 3^3.)

Q21. Write a program to add first n terms of the following series using a while loop:
1/1! + 1/2! + 1/3! + …….. + 1/n!

Q22. Write a program to enter the numbers till the user wants and at the end it should
display the sum of all the numbers entered.

Q23. Write a program to enter the numbers till the user enter ZERO and at the end it should
display the count of positive and negative numbers entered.

Q24. Write a program to find the HCF of two numbers entered from the user.

Q25. Write a program to convert Decimal to Binary.

Q26. Write a program to convert Binary to Decimal.

Q27. Write a program to check whether a number is palindrome or not.

Q28. Write a python program to sum the sequence:


1 + 1/1! + 1/2! + 1/3! + …….. + 1/n!

Q29. Write a program to accept 10 numbers from the user and display it’s average

Q30. Write a program to accept 10 numbers from the user and display the largest & smallest
number number.

Q31. Write a program to display sum of odd numbers and even numbers separately that fall
between two numbers accepted from the user.(including both numbers) using while loop.

Q32. Write a program to display all the numbers which are divisible by 13 but not by 3
between 100 and 500.(exclusive both numbers)

Q33. Write a program to print the following series till n terms.


2 , 22 , 222 , 2222 _ _ _ _ _ n terms

Q34. Write a program to print the following series till n terms.


1 4 9 16 25 _ _ _ _ _ n terms.
Q35. Write a program to find the sum of the following series(accept values of x and n from
user)
1 + x/1! + x2/2! + ……….xn/n!

Q36. Write a program to find the sum of following series :


x + x2/2 + ……….xn/n

Q37. Write a program to find the sum of following series


1 + 8 + 27 …………n terms

Q38. Write a program to find the sum of following series:


1 + 2 + 6 + 24 + 120 . . . . . n terms

Q39. Write a program to find the sum of following series:


S = 1 + 4 – 9 + 16 – 25 + 36 – … … n terms

Q40. Write a Program to print all the characters in the string ‘PYTHON’ using while loop.

Q41. Write a program to print only odd numbers from the given list using while loop. L = [23,
45, 32, 25, 46, 33, 71, 90]

Q42. Write a program to print all the factors of a number using while loop.

Q43. Write a python program to get the following output


1—–49

2—–48

3—–47


48—–2

49—–1

[Link] a program to extract all the upper case character from the given string
s=input(‘enter the string:’)

[Link] a Program to separate positive and negative number from a list.


x = eval(input('enter the list:'))
[Link] a program that appends the type of elements from a list.
n = [23, 'Python',23.98]

Q47. Write a program to fetch only even values from a dictionary.


dic = {'val1':10, 'val2':20, 'val3':23, 'val4':22 }

[Link] a program to extract all the string data items from the given list only
if string is palindrome

[Link] a program to extract all the special characters from the given string

[Link] a program to extract all the upper case character ,lower case
character ,numbers and special characters into four different output variables
from the given string

[Link] a program to get the following output -

[Link] a program to convert all the lower case charater to upper case
characters present in a given string

[Link] a program to convert all the lower case character to upper case
character and upper case character to lower case character by keeping number
and special character as it is

[Link] a program to extract all the lower case character from the given
string only if its ascii value is even

[Link] a program to get the following output


input=’abcd’
output={‘a’:97,’b’:98,’c’:99,’d’:100}

[Link] a program to get the following output


input=’hello’
output={0:’h’ , 1:’e’ , 2:’l’ , 3:’l’ , 4:’o’}

[Link] a program to get the following output


input=[‘hai’ , 89 ,3.4 , ‘hello’ , 90 , ‘py’]
output={‘hai’:’hi’ , ‘hello’:’ho’ , ‘py’:’py’}

[Link] a program to get the following output


input=‘hai hello’
output=’olleh iah’

[Link] a program to count the number of vowels present in a given string


[Link] a program to get the following output
input=‘hai hello good morning’
output={‘hai’:’a’ , ‘hello’: ‘l’ , ‘good’:’gd’ , ‘morning’:’n’}

[Link] a program to get the following output


input=[‘[Link]’ , ’[Link]’ , ‘[Link]’]
output=[‘com’ , ’py’ , ‘html’]

[Link] a program to get the following output


input=[‘[Link]’ , ’[Link]’ , ‘[Link]’ , ‘[Link]’ , ‘[Link]’]
output={‘com’:[‘jiocinema’ , ‘amazon’] , ’py’:[ ‘file’ , ‘text’]
, ‘html’:[‘web’]}

[Link] a program to get the following output(count no of vowels)


input=’hai hello’
output={‘hai’:2 , ‘hello’:2}

[Link] a program to extract all the string values present in the list collection
only if the last character is upper case. Concatenate the extracted output using
‘*’

[Link] a program to extract all the list data items present in list collection
only if it is having middle value , that value is integer and having even number
at start

[Link] a program to get the following output


input= ‘just looking like wow’
output= ‘jusT LOOKING Like a wow’

[Link] to find the common elements in two sets using a while loop
set1 = {1, 2, 3, 4, 5}
set2 = {3, 4, 5, 6, 7}

[Link] to check if a number is a perfect number or not using while loop

[Link] to find the length of the longest substring without repeating


characters in a given string using while loop

[Link] to find the maximum and minimum elements in a tuple using while
loop

[Link] to find the union, intersection, and difference of two sets using while
loop
[Link] to count the number of occurrences of each character in a string using
a dictionary and while loop

[Link] a program to remove duplicate value from collection without converting to set

[Link] a program to find the length of collection without using len function

[Link] a program to extract all the integers from a list only if the integer is starting from
even number and ending as odd number and having length more than 3

[Link] a program to extract all the individual data items of a list if the length of extracted
output is more than 4 print the first value of the output else print last value of the output list
and add 10 to it

[Link] a program to get the following output


input1=’11001010’
input2=’01110010’
output=4(to count how many positions are having same value)

Q80..Write a program to get the following output


input=[1,2,3,4,5,6]
value=3
output=[1,2,3][4,5,6]
If value=2
output=[1,2][3,4][5,6]

Q81..Write a program to check weather the given number is spy number or not
i.e, 1*2*3=1+2+3

[Link] a program to check weather the given number is Xylem number or


not i.e, 1234 → 1+4=2+3

[Link] a program to check weather the given number is phloem number or


not
I.e, 12345→ 1+5!=2+3+4

[Link] a program to check weather the given number is neon number or not
i.e. 9 is number, 9**2=81→8+1=9

[Link] a program to check weather the given number is automorphic or not


I.e.5 is number 5**2=25 last digit of 25 is the number itself

[Link] a program to count number of words in the given string


s=input('enter the str:').split()

[Link] a program to find the length of the longest word


[Link] a program to count number of consonants in the given string
s=input('enter the str:')

[Link] a program to check the type of data entered by the users

[Link] a program to check weather the given tuple is palindrome or not

[Link] a program to check weather the given collection is having nested


collection or not

Q92. Write a program to return the positions of vowels present in the given
string

Q93:Write a program to find length of collection without using len function

[Link] a program to whether the entered username and password is correct


or not if not correct print enter again

[Link] a program to extract all integer data items from tuple

[Link] a program to extract all the non default values from the list

[Link] a program to get the following output -


Input='hai hello how are you'
output='hai**hello**how**are**you'

[Link] a program to reverse the given list

[Link] a program for number game

[Link] a program to print ‘Thank you’ for n times

You might also like