Q. Find out the error and the reason for the error in the following code. Also, give the corrected code.

 

a, b = "5.0", "10.0"

x = float (a/b)

print(x)

 

Answer =

 

Correct code:-

 

a, b = 5.0, 10.0

x = float (a/b)

print(x)

 

Reason:- String value cannot divide. That’s why it give error.

1 Comments

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

  1. tq for this solution as it is very easy to copy

    ReplyDelete

Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post