Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

given _ items = [ one , two, 3 , 4 , five, [ six , seven, eight ] ] #Write

given_items =["one", "two", 3,4, "five", ["six", "seven", "eight"]]
#Write a program that iterates through the items in the
#given list. For each item, you should attempt to iterate
#through the item and print each character seperately.
#
#If this second part fails, print "Not iterable" -- but
#even if the second part fails, you should still go on
#to the next item in the list.
#
#Hint: Although we'll cover lists more in Unit 4, all
#you need to know right now is that this syntax will run
#a loop over a list, a string, or any other iterable
#type of information:
#
# for item in given_items:
#
#To iterate over the items in 'item', you can do the
#same thing: for subitem in item:
#
#Start out by building the nested for-each loops that
#you'll need. Then, identify where the error is
#occurring to figure out where to put the try-except
#structure.
#
#This one's tricky, but you can do it!

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Database Management

Authors: Jeffrey A. Hoffer Fred R. McFadden

4th Edition

0805360476, 978-0805360479

More Books

Students also viewed these Databases questions

Question

What is a NULL value?

Answered: 1 week ago