For more codes click here
#check data type for all elements in a list
a = [1,"pease", 4, "dog"]
for i in a:
if isinstance(i, int):
print(f"{i} is an integer")
elif isinstance(i, str):
print(f"{i} is a string")
else:
pass
Climb up the chart of development, from web, to software and games. Build your foundations and get certified. Let me help you get your first tech job.
For more codes click here
#check data type for all elements in a list
a = [1,"pease", 4, "dog"]
for i in a:
if isinstance(i, int):
print(f"{i} is an integer")
elif isinstance(i, str):
print(f"{i} is a string")
else:
pass
Function is a collection of operations which can be easily accessed throughout a program. these operation accepts a variable and passes it through the stated operations to give an output.
Loops are used to iterate within a set of variables. This can either be a list, string, tuple etc.