this is python
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
<ipython-input-1-77bee4b416ba> in <module>()
----> 1 this is python
NameError: name 'this' is not defined
SEARCH STACK OVERFLOW
'''this is parapraph syntex
pppp'''
'this is parapraph syntex\npppp'
Premitive data
var_1=10
print(var_1)
10
type(var_1)
int
var_2= 'this is string data type'
var_3 = 'this is also string data type'
type(var_2)
str
type(var_3)
str
var_4=1234.5576
#Complex Value
var_5 = 234+56j
print(var_5)
(234+56j)
bool_1 = True
var_6=b'this is python programe'
print(var_6)
b'this is python programe'
#Emty List Declaration
list_1=[]
list_1 = [101, 'This is a list', True, False, 1010101,12345.67, 34+56j]
#Array - Homogeous collection of data
list_2 = ['a','b','c','d']
print(list_2)
['a', 'b', 'c', 'd']
list_3 = [1010101, True, False, 12301, 121331.12, 1132+46j]
#Methods for list
# append - to add the data at the end of data
list_3.append(123455678)
print(list_3)
[1010101, True, False, 12301, 121331.12, (1132+46j), 123455678]
# copy content of list_3 to list_4
list_4 = list_3.copy()
#COncatination
list_5=list_1+list_3
print(list_5)
[101, 'This is a list', True, False, 1010101, 12345.67, (34+56j), 1010101, True, False, 12301,
#countthe no. of values present in the list
len(list_5)
14
#insert - method to add the value at an indexedposition
list_1.insert(3, 'New Value')
print(list_1)
[101, 'This is a list', True, 'New Value', 'New Value', False, 1010101, 12345.67, (34+56j)]
#pop - methos to delete value at indexed position
list_5.pop(11)
121331.12
#Removing data from the list
list_1.remove(34+56j)
#printing value at indexed position
print(list_1[3],list_1[5])
New Value False
#slicing the data
print(list_5[:])
[101, 'This is a list', True, False, 1010101, 12345.67, (34+56j), 1010101, True, False, 12301,
# Display values starting from indexed position 2 and will stop at n-1 position
list_5[2:7]
[True, False, 1010101, 12345.67, (34+56j)]
# To print last 8 values in list
print(list_5[-8 : ])
[12345.67, (34+56j), 1010101, True, False, 12301, (1132+46j), 123455678]
#Immuutable data types
tuples_1 = ()
tuples_2 = (True, False,'New Entry')
# Concatination
tuples_3 = tuples_1 + tuples_2
list_1[2] = 1226824816128
print(list_1)
[101, 'This is a list', 1226824816128, 'New Value', 'New Value', False, 1010101, 12345.67]
tuple_3[3] = 'New Value'
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
<ipython-input-60-d40487bb9032> in <module>()
----> 1 tuple_3[3] = 'New Value'
NameError: name 'tuple_3' is not defined
SEARCH STACK OVERFLOW
0s completed at 12:05 PM