Harry

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

In [1]:

a=5

In [ ]:

In [2]:
a

Out[2]:

In [3]:

b=9

In [4]:
a+b
Out[4]:

14

In [5]:
b

Out[5]:
9

In [6]:

a
Out[6]:

In [7]:
c='harry'

In [8]:
type(c)
Out[8]:

str

In [9]:
c='130'

In [10]:
type(c)
Out[10]:
str

In [11]:
q=9.087

In [12]:
type(q)
Out[12]:
float

In [13]:

n=True

In [14]:
type(n)
Out[14]:
bool

In [15]:
n=None

In [16]:
type(n)
Out[16]:

NoneType

In [17]:
6*6
Out[17]:
36

In [18]:
6**6
Out[18]:
46656

In [19]:
6**3
Out[19]:
216

In [20]:
6%3
Out[20]:
0

In [21]:

77/11
Out[21]:
7.0
In [22]:
77//11
Out[22]:

In [23]:
77%11
Out[23]:
0

In [24]:
s='Hello'

In [25]:
s+4

---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-25-56de6d8afa3d> in <module>
----> 1 s+4

TypeError: can only concatenate str (not "int") to str

In [29]:
s+''s

File "<ipython-input-29-32976c7ad218>", line 1


s+''s
^
SyntaxError: invalid syntax

In [27]:
s + s
Out[27]:
'HelloHello'

In [28]:
(s+s).split()
Out[28]:
['HelloHello']

In [31]:
s+''+s
Out[31]:
'HelloHello'

In [32]:
s +' '+s
Out[32]:
'Hello Hello'

In [33]:
s+" "+s
Out[33]:
'Hello Hello'

In [34]:
s*4
Out[34]:
'HelloHelloHelloHello'

In [35]:
x=7

In [36]:
if x==7:
print("hi")
else:
print("bye")

hi

In [37]:
x=int(input("enter number"))
if x==7:
print("hi")
else:
print("bye")

enter number4
bye

In [38]:
True
Out[38]:
True

In [39]:
true

---------------------------------------------------------------------------
NameError Traceback (most recent call last)
<ipython-input-39-724ba28f4a9a> in <module>
----> 1 true

NameError: name 'true' is not defined

In [40]:
False
Out[40]:
False

In [41]:
1
Out[41]:
1
In [ ]:

In [42]:
bool(1)
Out[42]:
True

In [43]:
bool(0)
Out[43]:
False

In [44]:
s="harry"

In [45]:
s.title()
Out[45]:
'Harry'

In [46]:
s.lower()
Out[46]:
'harry'

In [47]:
s.upper()

Out[47]:
'HARRY'

In [48]:
p='eswar'

In [ ]:
p.upper()

You might also like