Skip to content

Instantly share code, notes, and snippets.

@Sshashank0743
Forked from cibofdevs/loop_each_and_type.py
Created June 28, 2020 10:29
Show Gist options
  • Save Sshashank0743/754ee6aa54fb21b484d0fa5c0fc3c4bf to your computer and use it in GitHub Desktop.
Save Sshashank0743/754ee6aa54fb21b484d0fa5c0fc3c4bf to your computer and use it in GitHub Desktop.
# Write one for loop to print out each element of the list several_things.
# Then, write another for loop to print out the TYPE of each element of the list several_things.
# To complete this problem you should have written two different for loops,
# each of which iterates over the list several_things, but each of those 2 for loops should have a different result.
several_things = ["hello", 2, 4, 6.0, 7.5, 234352354, "the end", "", 99]
for i in range(len(several_things)):
print(several_things[i])
for j in range(len(several_things)):
print(type(several_things[j]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment