Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Look at the following code segment. We have hardcoded some values for you in the list 'values' and created a loop through the values

Look at the following code segment. We have hardcoded some values for you in the list 'values' and created a

Look at the following code segment. We have hardcoded some values for you in the list 'values' and created a loop through the values in the list. If the value is a string raise a ValueError that says "This is a string!". Use this code as a guide and fill in the yellow placeholder. 1. values = [1,2,3,4,5, "hello",6,7,8,9, "10"] 2. 3. for cur in values: 4. 5. 6. print("The value is :", values [cur]) if type(values [cur]) ==str:

Step by Step Solution

3.42 Rating (149 Votes )

There are 3 Steps involved in it

Step: 1

This code will iterate through the elements in the values list If it encounters a string it wil... 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

Step: 3

blur-text-image

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

Foundations of Financial Management

Authors: Stanley Block, Geoffrey Hirt, Bartley Danielsen, Doug Short, Michael Perretta

10th Canadian edition

1259261018, 1259261015, 978-1259024979

More Books

Students also viewed these Programming questions