Question: Please solve this Consider the following list which contains elements of number data type and string data type alternatively: A = [3, '$', 5, '#',
Consider the following list which contains elements of number data type and string data type alternatively: A = [3, '$', 5, '#', 2, '%'] That is, the list will first contain element of numeric data type followed by an element (symbol) of string data type, followed by an element of numeric data type and so on. Write a non-recursive function in python to first read the element of numeric data types and then the symbol followed by it. The function should print the symbol that many number of times as denoted by value associated with the previous numeric data type. The function should take the list as an input parameter. For the above given list, the program should print the symbol '$' 3 times, followed by printing the symbol '#' 5 times, followed by printing the symbol '%' 2 times
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
