Question: Create a stacktrace for this code for an upvote please quickly assignment is due soon starter code: #define our bookshelf myShelf = Little Women~An Absolutely
Create a stacktrace for this code for an upvote please quickly assignment is due soon
starter code:
#define our bookshelf myShelf = "Little Women~An Absolutely Remarkable Thing~The Bluest Eyes~Python for Everyone~The Hunger Games~Fun Home" #Function bookCount should take a string and return the number of books on your shelf def bookCount(): #turn into list #count list return print("How many books? ", bookCount(myShelf))
code that needs stacktrace:
myShelf = "Little Women~An Absolutely Remarkable Thing~The Bluest Eyes~Python for Everyone~The Hunger Games~Fun Home" #Function bookCount should take a string and return the number of books on your shelf def bookCount(myShelf): splitText = myShelf.split("~") # split to a list using ~ as a splitting point size = len(splitText) # find out length of the list return size # return the length print("How many books? ", bookCount(myShelf)) Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
