Py Excercise
Py Excercise
11.
12.
14.
111111111
222222222
333333333
444444444
555555555
666666666
777777777
888888888
999999999
15.
1
12
123
1234
12345
16.
1
22
333
4444
55555
17. Print a downward Half-Pyramid Pattern of Star (asterisk)
*****
****
***
**
*
18. Wap to print no from 1 to 10
19. Wap to print table of any no
20. Wap to print sum of any five no
21. Wap to print multiplication of any seven no
22. Wap to print reverse of any no
23. Wap to check no is Armstrong or not
24. Wap to check no is palindrome or not
25. Python program to display all the multiples of 3 within the range 10 to 50
Function program
26. Python program to find the factorial of a number using recursion
list Programs
27. Write a program to display only those numbers from a list that satisfy the following
conditions
The number must be divisible by five
If the number is greater than 150, then skip it and move to the next number
If the number is greater than 500, then stop the loop
numbers = [12, 75, 150, 180, 145, 525, 50]
output ----75
150
145
28. Wap to print list in loop
29. Find sum and average of list in python
30. Python program to implement linear search
31. Python program to implement binary search
32. Python program to find the largest number in a list without using built-in functions
33. Python program to insert a number to any position in a list
34. Python program to delete an element from a list by index
35. Display numbers divisible by 5 from a list
36. Wap to find even and odd numbers in a list
37. Python program to interchange first and last elements in a list
38. Python program to swap two elements in a list
39. Python | Ways to check if element exists in list
40. How to count unique values inside a list
41. Write a program to count the number of items stored in a list.
42. Python program to square each element of a list.
43. Python program to remove an empty element from a list.
44. Write a program to sum all the elements of a list.
Tuple Programs
45. Python program to Find the size of a Tuple
46. Python – Maximum and Minimum K elements in Tuple
47. Python – Sum of tuple elements
48. Swapping first and last element in tuple
49. Adding Tuple to List and vice – versa
50. Reverse the tuple
51. tuple1 = (10, 20, 30, 40, 50)
52. tuple1 = tuple1[::-1]
53. print(tuple1)
set Programs
54. Find the size of a Set in Python
55. Python – Maximum and Minimum in a Set
56. Python – Remove items from Set
57. Python program to count number of vowels and consonant using sets in given string
58. Union
59. Intersection
60. Difference
61. Symmetric difference
set Programs
62.
63. Check Python version
import sys # Import the sys module to access system-specific parameters and functions
# Print the Python version to the console
print("Python version")
# Use the sys.version attribute to get the Python version and print it
print(sys.version)
# Print information about the Python version
print("Version_info.")
# Use the sys.version_info attribute to get detailed version information and print it
print(sys.version_info)
Python: Print current time and date
64. program to draw a circle of squares using Turtle
import turtle
x=turtle.Turtle()
def square(angle):
x.forward(100)
x.right(angle)
x.forward(100)
x.right(angle)
x.forward(100)
x.right(angle)
x.forward(100)
x.right(angle+10)
for i in range(36):
square(90)
Output: