#program to append a list based on the type to be appended
l1=[1,2,3,4]
print("Original list is:",l1)
n=eval(input("Enter anumber or a list to be appended: "))
if type(n)==type([]):
l1.extend(n)
elif type(n)==type(1):
l1.append(n)
else:
print("Enter an integer or a list")
print("Appended list is",l1)
Comments
Post a Comment