Posts

Variable Declaration in python

Image
  Variable Declaration: A variable is nothing but a name given to a storage area that our programs can manipulate . A Variable is the heart of every good programming language, including  Python . Variables are changed time to time, because they have dynamic nature. A variable is nothing but a reserved memory location to store values. In other words, a variable in a program gives data to the computer to work on. Every value in Python has a data type. Different data types used in Python are Numbers, List, Tuple, Strings, Dictionary, etc. Variables can be declared by any name or even alphabets like total_amount, Marks, Sname, etc. These are the following rules of writing variable in python programming- ·          Every variable starts with a character, underscore "_" or a upper-case   or lower-case letter. ·          Always variable must be start with alphabet after that we can use num...

Addition, subtraction, multiplication and division of two number in python

Image
Write a program to input two values and addition, subtraction, multiplication and division of these numbers.    a = input('Enter first number: ') b = input('Enter second number: ') # Addition two numbers c = int(a) + int(b) # Display the addition print('Addition of {0}  +  {1}  = {2}'.format(a, b, c)) # Subtraction two numbers c = int(a) - int(b) print('Subtraction of {0}  +  {1}  = {2}'.format(a, b, c)) # multiplication two numbers c = int(a) * int(b) print('multiplication of {0}  +  {1}  = {2}'.format(a, b, c)) # Division two numbers c = int(a) / int(b) print('Division  of {0}  +  {1}  = {2}'.format(a, b, c))   Output: