Chinese, asked by mkaneesh6565, 17 days ago

gadgets = ["Mobile", "Laptop", 100, "Camera", 310.28, "Speakers", 27.00, "Television", 1000, "Laptop Case", "Camera Lens"]

Answers

Answered by 1031048
0

Answer:

gadgets = [“Mobile”, “Laptop”, 100, “Camera”, 310.28, “Speakers”, 27.00,  “Television”, 1000, “Laptop Case”, “Camera Lens”]

a) Creating a separate list of strings and numbers by checking each element of the list.

gadgets = ["Mobile", "Laptop", 100, "Camera", 310.28, "Speakers", 27.00, "Television", 1000, "Laptop Case", "Camera Lens"]

sl = list()

nl = list()

for i in gadgets:

if type(i) == str:

  sl.append(i)

else:

  nl.append(i)

print(sl, "is the list of string values.")

print(nl, "is the list of numerical values.")

b) Sorting the strings list in ascending order.

This is done with the view that it proceeds from the above coding. If not, a program will have to be made to create a list solely for string, something similar to the one above, excluding the numerical part.

sl.sort()

print(sl)

c) Adding an element 56.89 to the number list.

nl.append(56.89)

print(nl)

d) Replacing the element "Speakers" to "Headphones".

sl.replace("Speakers", "Headphones")

print(sl)

e) Deleting the second element of the numbers list.

del nl[1]

print(nl)

f) Displaying the modified strings and number lists.

print(sl, "is the new list of strings.")

print(nl, "is the new list of numbers.")

Answered by imageniuss
1

\huge\red{\boxed{\tt{{A}}}}\huge\green{\boxed{\tt{{N}}}}\huge\blue{\boxed{\tt{{S}}}}\huge\red{\boxed{\tt{{W}}}}\huge\green{\boxed{\tt{{E}}}}\huge\blue{\boxed{\tt{{R}}}}

gadgets = [“Mobile”, “Laptop”, 100, “Camera”, 310.28, “Speakers”, 27.00,  “Television”, 1000, “Laptop Case”, “Camera Lens”]

a) Creating a separate list of strings and numbers by checking each element of the list.

gadgets = ["Mobile", "Laptop", 100, "Camera", 310.28, "Speakers", 27.00, "Television", 1000, "Laptop Case", "Camera Lens"]

sl = list()

nl = list()

for i in gadgets:

if type(i) == str:

 sl.append(i)

else:

 nl.append(i)

print(sl, "is the list of string values.")

print(nl, "is the list of numerical values.")

b) Sorting the strings list in ascending order.

This is done with the view that it proceeds from the above coding. If not, a program will have to be made to create a list solely for string, something similar to the one above, excluding the numerical part.

sl.sort()

print(sl)

c) Adding an element 56.89 to the number list.

nl.append(56.89)

print(nl)

d) Replacing the element "Speakers" to "Headphones".

sl.replace("Speakers", "Headphones")

print(sl)

e) Deleting the second element of the numbers list.

del nl[1]

print(nl)

f) Displaying the modified strings and number lists.

print(sl, "is the new list of strings.")

print(nl, "is the new list of numbers.")

#LearnWithBrainly

#BrainlyFast

\huge\red{\boxed{\tt{{C}}}}\huge\green{\boxed{\tt{{A}}}}\huge\blue{\boxed{\tt{{R}}}}\huge\red{\boxed{\tt{{R}}}}\huge\green{\boxed{\tt{{Y}}}}\huge\blue{\boxed{\tt{{O}}}}\huge\red{\boxed{\tt{{N}}}}\huge\green{\boxed{\tt{{L}}}}\huge\blue{\boxed{\tt{{E}}}}\huge\red{\boxed{\tt{{A}}}}\huge\green{\boxed{\tt{{R}}}}\huge\blue{\boxed{\tt{{N}}}}\huge\red{\boxed{\tt{{I}}}}\huge\green{\boxed{\tt{{N}}}}\huge\blue{\boxed{\tt{{G}}}}

(。・∀・)ノ

Similar questions