Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

python 16.16 Lab 3 Part D: Guess the Data Type When we read values using the input command, they always start as strings If we

python

image text in transcribed

16.16 Lab 3 Part D: Guess the Data Type When we read values using the input command, they always start as strings If we try to convert a string to an integer or a float and the conversion fails, an error will be thrown. Specifically, a value error. We can catch this error using an except statement. The following example shows an error being caught. try: x int("Not a Number") except ValueError as e: print("Error:", e) If the code is executed, it will print Error: invalid literal for int) with base 10: 'Not a Number' For this part of the lab, ask the user for an input and use try/except statements to determine if the data is an integer, float, or string. The interface should match the following examples. Welcome to Type Guesser Enter Something: You entered an integer! Value: 9 Welcome to Type Guesser Enter Something: 12.9 You entered a float! Value: 12.9 Welcome to Type Guesser Enter Something: Oranges You entered a string! Value: Oranges Welcome to Type Guesser Enter Something: 12.9 Oranges You entered a string! Value: 12.9 Oranges LAB ACTIVITY 16.16.1: Lab 3 Part D: Guess the Data Type 0/4 main.py

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

Students also viewed these Databases questions

Question

Name at least three factors that can impact project performance.

Answered: 1 week ago

Question

11.3 Define pay equity and explain its importance today.

Answered: 1 week ago

Question

5. Discuss the key components of behavior modeling training.

Answered: 1 week ago

Question

4. Develop a self-directed learning module.

Answered: 1 week ago

Question

2. Provide recommendations for effective on-the-job training.

Answered: 1 week ago