In [1]:
1+1
Out[1]:
In [2]:
1*3
Out[2]:
In [3]:
5/5
Out[3]:
In [4]:
1/2.0
Out[4]:
In [5]:
2**3
Out[5]:
In [6]:
(2 + 3) * (5 + 5)
Out[6]:
In [7]:
4%2
Out[7]:
In [8]:
5%2
Out[8]:
In [9]:
var x = 4
var y = 16
var z = y/x
In [10]:
y/x
In [16]:
x = 2
y = 10
z = y/x
print(z)
In [12]:
y
Out[12]:
In [13]:
x
Out[13]:
In [14]:
y/x
Out[14]:
In [17]:
# strings
name = "shashank ragireddy"
print(name)
In [21]:
course = "Engineering"
print("My name is {} and i'am an student of {}".format(name,course))
In [24]:
s = "shashank"
In [25]:
s[0]
Out[25]:
In [26]:
s[0:]
Out[26]:
In [27]:
S[:3]
In [28]:
s[:4]
Out[28]:
In [29]:
s[0:2]
Out[29]:
In [30]:
s[3:5]
Out[30]:
In [31]:
s[5:7]
Out[31]:
In [35]:
my_list = ["a","b","c"]
In [39]:
my_list
Out[39]:
In [ ]:
my_list.append('d')
In [40]:
my_list[0:3]
Out[40]:
In [41]:
my_list[:4]
Out[41]:
In [42]:
my_list[3:4]
Out[42]:
In [43]:
my_list[2:4]
Out[43]:
In [44]:
my_list[0:3]
Out[44]:
In [45]:
my_list[1:3]
Out[45]:
In [46]:
nest=[1,2,[3,4],[5,6],7,8,[9,10],[11,12],13,[14,15,16,17]]
nest
Out[46]:
In [47]:
nest[1]
Out[47]:
In [48]:
nest[3]
Out[48]:
In [49]:
nest[3[1]]
In [50]:
nest[3][1]
Out[50]:
In [51]:
1 > 3
Out[51]:
In [52]:
1 == 1
Out[52]:
In [53]:
1 != 4
Out[53]:
In [54]:
1==1 and 2 >3
Out[54]:
In [55]:
1==1 and 2>4
Out[55]:
In [56]:
1==1 and 2>1
Out[56]:
In [58]:
if 2 > 1:
print('2 is greater than 1')
In [67]:
In [ ]:
In [71]:
2>4
Out[71]:
In [72]:
if 10 > 5:
print('greater')
In [77]:
In [81]:
x = 5
if x > 5:
print('The value is greater than 5')
if x < 5:
print('The value is less than 5')
else:
print('The value is equal')
In [ ]:
x = 5
if x > 5:
print('The value is greater than 5')
if x < 5:
print('The value is less than 5')
else:
print('The value is equal')
In [ ]: