PythonAssignment_DebdutSarkar (1)
PythonAssignment_DebdutSarkar (1)
list = [1,2,3,4,5,6,7]
print(list[0])
print(list[1])
print(list[2])
print(list[3])
# Slicing the elements
print(list[0:6])
# By default, the index value is 0 so its starts from the 0th element and go for index -1.
print(list[:])
print(list[2:5])
print(list[1:6:2])
list1 = [1,2,2,3,55,98,65,65,13,29]
# Declare an empty list that will store unique values
list2 = []
for i in list1:
if i not in list2:
list2.append(i)
print(list2)
# Creating a tuple
sampleTuple = ("Apple", "Mango", "Banana", "Orange", "Guava", "Berries")
# Creating a tuple
sampleTuple = ("Apple", "Mango", "Banana", "Orange", "Guava", "Berries")
# Printing the entire tuple by using the default start and end values
print("Entire tuple: ", sampleTuple[:])
# Creating a tuple
sampleTuple = ("Apple", "Mango", "Banana", "Orange", "Guava", "Berries")
# printing the entire tuple for reference
print("Given Tuple:", sampleTuple)
# Deleting the variable from the global space of the program using the del keyword
del sampleTuple
# Python program to demonstrate the approach of changing the element in the tuple
# creating a tuple
fruits_tuple = ("mango", "orange", "banana", "apple", "papaya")