Nothing Special   »   [go: up one dir, main page]

Python Notes: Invented By: Guido Van Rossum (1991)

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

PYTHON NOTES

Only for reference, Do not copy paste.

Invented by: Guido Van Rossum (1991)

Python allows branching (part), looping (repeating) as well as modular programming.

Store: Character- 4 bites and Integer- 2 bites.

Using python we can do data analysis & statistical functions.

Program: takes INPUT gives OUTPUT

Note: For adding comment in python:

 Single line comment: #


 Multiple line comment: “”” “””

Program Integer:- when both numbers are integer (eg: 2,3)


x=int(input(“enter number”))

print(“the number is”,x, “and class is”,type(x))

Program Float:- when both numbers are decimal (eg: 2.9,3.5)


x=float(input(“enter number”))

print(“the number is”,x, “and class is”,type(x))

Program Eval:- when both numbers are unknown, can be decimal or integer (eg: 2.9,3.5)
x=eval(input(“enter number”))

print(“the number is”,x, “and class is”,type(x))

OPERATIONS IN PYTHON:

+ addition 6+2=8
- subtraction 6-2=4
* multiplication 6*2=12
/ division 6/2=3.0
% modulo (reminder of division) 6%2=0
// It gives int division 6//2=3
** Exponential 6**2=36
ADDITION:
num1=eval(input(“enter first number”))

num2=eval(input(“enter second number”))

ans=num1+num2

print(“the addition of two number is”,ans)

OR

You might also like