simple operation on python:

Simple operation on PYTHON

Generally following operation can be performed by the python:

  1. Addition (+)

  2. Subtraction(-)

  3. Multiplication(*)

  4. Division(/)

  5. Modulus(%)

let study the operation in details:

  1. Addition:

Bascially addition means adding up two number.Following operation can be performed in two manner

  • By adding it directly.

  1. write the two number to be add
  2. output will be given.

so the output will be shown:

  • By writing a code.

  1. open IDLE
  2. click on the file.
  3. click on NEW.
  4. write the required code.
  5. output will b shown.

CODE:

this is the required code

The run the following code:

output:

hence in this way both program can performed.

  2. Subtraction:

In python (-) symbol represent subtraction.

basically subtraction means subtracting two number

this can be performed in two manner

  • by subtracting directly :
  1. first we will open idle
  2. type the number you want to subtract.
  3. finally it will show you the output.

 

  • by writing code
  1. first we will open idle.
  2. then click on file.
  3. click on new file.
  4. type the required code their.
  5. then press RUN
  6. output will be shown.

output:

3. Multiplication:

In python (*) asterisk symbol is used to perform multiplcation.

there are two ways to multiply the number in IDLE software.

  • By multiplying them directly.
  1. first write the number that you have to multiply.
  2. the required output will be shown.

output:

  • By writing code.
  1. Open the IDLE.
  2. click on file.
  3. click on NEW.
  4. write the required code

CODE:

OUTPUT:

4.Division:

In python (/) following symbol is used to perform division.

there are two ways to perform division.

  • By directly dividing the number.
  1. OPen IDLE.
  2. then type the number you want to divide
  3. output will be shown.

  • By writing the code:
  1. Open IDLE.
  2. click on NEW.
  3. type the required code.
  4. the output will be shown.

CODE:

OUTPUT:

 

 

5.MODULUS:

firstly what is modulus is the remainder when in number id divided.

it’s a whole number.

for example

5%2=1

hence 1 is modulus here

In python (%) following symbol is used to do the program.

there are two ways to perform the following function.

  •  By direct method
  • By writing code

 

  1. Direct method :
  • in this method we write the number directly on IDLE screen
  • like given below…

OUTPUT:

 

  1. CODE method:
  • In this method we have to first Open IDLE.
  • Then click on file
  • click NEW
  • write the required code
  • output will be shown.

CODE:

 

 

OUTPUT:

 

 

Lets performance same basic program of python.

1.Write the PYTHON programm to add two number then multiply the solution with the subtraction of given two number and show the output?

EXP:

In this program the write want to take two number from the user then add those number then subtract the two number and then multiply the solution of addition and subtraction that will be the output of given problem

required code

output

  1. then first we enter first number:5
  2. then second number:3
  3. sum=5+3=8
  4. sub=5-3=2
  5. mul=8*2=16

OUTPUT:

 

more problem can be solved

1)addition of two number

2)print table of 25 or any other  number required by user?

many more…..

 

BY:Shraddha.

 

Add Comment

%d bloggers like this: