190k views
4 votes
Choose the correct function to convert the user’s response to the number 3.5. >>> answer = input("How much does the sample weigh in grams? ") How much does the sample weigh in grams? 3.5 >>> numberAnswer = (answer)

User Morniak
by
4.4k points

2 Answers

1 vote

Answer:

I think the answer is float

Step-by-step explanation:

User Kranzky
by
5.6k points
2 votes

Answer:

The answer to the given question is given bellow in the explanation section:

Step-by-step explanation:

<p>This is python code</p>

<p>In python when you enter input into the input function as given:</p>

<code> answer = input("How much does the sample weigh in grams? ") </code>

I will be taken as string.

So I have to convert this string to number format here the given data is float value i-e 3.5

so let convert it. using float function.

<code> answer = float (input("How much does the sample weigh in grams? ") ) </code>

User Doak
by
5.6k points