Category: Python Programs Tutorials

python tutorials and learn python

Python program to search an element in a doubly linked list.

Python program to search an element in a doubly linked list. In this program, we need to search a given node in a doubly linked list. To solve this problem, we will traverse through the list using a node current. Current points to head and start comparing searched node data with current node data. If…

Python Programs

Python Programs There can be various python programs on many topics like basic python programming, conditions and loops, functions and native data types. A list of top python programs are given below which are widely asked by interviewer. Basic Python programs Python program to print “Hello Python” Python program to do arithmetical operations Python program…

Python program to do arithmetical operations

Python program to do arithmetical operations The arithmetic operations are performed by a calculator where we can perform addition, subtraction, multiplication, and division. This example shows the basic arithmetic operations i.e. Addition Subtraction Multiplication Division See this example: # Store input numbers: num1 = input(‘Enter first number: ‘) num2 = input(‘Enter second number: ‘) # Add two numbers sum = float(num1) + float(num2) # Subtract two numbers min = float(num1) – float(num2) # Multiply two numbers mul = float(num1) * float(num2) #Divide two numbers div = float(num1) / float(num2) # Display the sum print(‘The sum of {0} and {1} is {2}’.format(num1, num2, sum)) # Display the subtraction print(‘The subtraction of {0} and {1} is {2}’.format(num1, num2, min)) # Display the multiplication print(‘The multiplication of {0} and {1} is {2}’.format(num1, num2, mul))…