100 Python Programs
100 Python Programs
print('Hello World!')
All the developers would have started their career with this simple program. We have
used the print( ) function here. Text inside this function enclosed within single-quote(’ ‘)
or double-quotes(” “) gets printed as it is. Python is one of the most loved and the
easiest programming language because of its simple syntax.
Syntax - An approved set of rules or pre-defined protocols that we need to follow while
working in a programming language.
Output of the Program -
2) Write a Python program to Find the area of circle , square and rectangle by
getting input from the user.
We get the input of the shape and store it in the variable shape. Using the if-condition ,
we find the shape and apply the respective formula. Finally, print the output from the
variable area.
Get the input of the values separated with comma simply using the input method. In
default, this gets stored as string. The split() method splits a string into a list. You can
4) Write a Python program to get the volume of a cube, sphere and cuboid with by
getting input from the user.
5) Take a list and print First , Last and Middle value(if list has odd length) of the
list.
list1 = ["python","java","html","css","js"]
i = len(list1)
print("First value is",list1[0])
print("Last value is",list1[i-1])
if i%2 != 0:
print("mid value is:",list1[i//2])
if num%2==0:
print(num,"is even")
else:
print(num,"is odd")