Question: 5- Python has integer, float, and string data types, concatenate any of those data types are accepted (like string + float). (True, False) 6- Tuple
5- Python has integer, float, and string data types, concatenate any of those data types are accepted (like string + float). (True, False)
6- Tuple is immutable while list is mutable. (True, False)
7- A=[n1, n1, n3, n3, n4, n4], to remove the duplicates of list A, we can use the following code A=list(set(A)). (True, False)
8- def find_FL(list1):
length = len(list1)
list1.sort()
print("Largest element is:", list1[length-1])
print("Smallest element is:", list1[0])
*All good with the above function. (True, False).
9- def range_F2L2(list1):
largest = list1[0]
largest2 = list1[0]
lowest = list1[0]
lowest2 = list1[0]
for item in list1:
if item > largest:
largest = item
elif largest2!=largest and largest2 < item:
largest2 = item
elif item < lowest:
lowest = item
elif lowest2 != lowest and lowest2 > item:
lowest2 = item
print("Largest element is:", largest)
print("Smallest element is:", lowest)
print("Second Largest element is:", largest2)
print("Second Smallest element is:", lowest2)
*All good with the above function. (True, False
5- Python has integer, float, and string data types, concatenate any of those data types are accepted (like string + float). (True, False)
6- Tuple is immutable while list is mutable. (True, False)
7- A=[n1, n1, n3, n3, n4, n4], to remove the duplicates of list A, we can use the following code A=list(set(A)). (True, False)
8- def find_FL(list1):
length = len(list1)
list1.sort()
print("Largest element is:", list1[length-1])
print("Smallest element is:", list1[0])
*All good with the above function. (True, False).
9- def range_F2L2(list1):
largest = list1[0]
largest2 = list1[0]
lowest = list1[0]
lowest2 = list1[0]
for item in list1:
if item > largest:
largest = item
elif largest2!=largest and largest2 < item:
largest2 = item
elif item < lowest:
lowest = item
elif lowest2 != lowest and lowest2 > item:
lowest2 = item
print("Largest element is:", largest)
print("Smallest element is:", lowest)
print("Second Largest element is:", largest2)
print("Second Smallest element is:", lowest2)
*All good with the above function. (True, False
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
