Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

His program is shown below: # Knightro # Lab 1 : Challenge 1 # COP 2 5 0 0 # Aug 2 8 , 2

His program is shown below:
# Knightro
# Lab 1: Challenge 1
# COP 2500
# Aug 28,2023
# Ask for input
steps=input ("How many steps?
")
distance=input ("Total feet traveled?
")
# Calculate Steps
pace = distance*12? steps
# Output paces as inches
print("Your average step is",pace, "inches")
He is getting this error.
pace = distance*12? steps
TypeError: unsupported operand type(s) for /: 'str' and 'str'
This is because distance and steps are not numeric data but strings. How can we correct his program so it can run?
Question 1
2 pts
The number of steps should be a whole number. How can we correct this line of code to accept input as a whole number?
steps=input ("How many steps?
")
image text in transcribed

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

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

A Complete Guide To Data Science Essentials

Authors: Miguel

1st Edition

9358684992, 978-9358684995

More Books

Students also viewed these Databases questions