You are on page 1of 5

a=10

10

## Comments
## for single we use ##
## this is a function
# this is a comment
a=20
a

20

"""
Example of multiline comments
hello this is a example of python
dsfsdfdfdsf
dfsdfsdfsdfdsf
dfdsfdsfsdf
"""
a=20
a

20

hello
hello1
hello2
1. hello guys how are you

Numbers
1+3

print(1+3)

a=5
print(a)

print("hello world my name is krish i work in \n PW skills and


ineuron")
hello world my name is krish i work in
PW skills and ineuron

Variables Assignment
name="Krish"
company="PWskills and ineuron"

type("sfdfdfsdf")

str

type(name)

str

name="Bala"

name

'Bala'

company

'PWskills and ineuron'

number=10

type(number)

int

number=20
number

20

decimal_num=2.5

decimal_num

2.5

type(decimal_num)

float

type("hello")

str

type(1+2j)

complex
print('hello')
print("hello")

hello
hello

##bad way
## dont start the variable name with numbers
1a
3answer

number1=23

## Variables are case senssitive


company='ineuron'
Company='PWSKILLS'
print(company)
print(Company)

ineuron
PWSKILLS

## Reserved keywords
'''
int,float,len,complex,bool,str,return,yield
'''

float=32

##Boolean
True

True

False

False

True and False

False

True or False

True

not True

False

type(not False)

bool
## Typecasting
bool(0)

False

str(23)

'23'

int('23')

23

type(int('23'))

int

bool(1)

True

a=1
if bool(a)==True:

print("True")

True

int('123')

123

Dynamic Typing
a=12
str1="Krissh"
a="var"

print(type(a))

<class 'str'>

int(1.54)

## concatenation between different types

int("1") + "1"

----------------------------------------------------------------------
-----
TypeError Traceback (most recent call
last)
Cell In[90], line 1
----> 1 int("1") + "1"
TypeError: unsupported operand type(s) for +: 'int' and 'str'

"1" * 100

'111111111111111111111111111111111111111111111111111111111111111111111
1111111111111111111111111111111'

You might also like