51.7k views
1 vote
Which code causes a ValueError?

int('4')

3 / 0

int('four')

3 / 2.0

User IAmDranged
by
5.6k points

1 Answer

1 vote

Answer:

Option 3: int('four') is the correct asnwer

Step-by-step explanation:

ValueError occurs in Python when we try to store wrong content in the datatype or conversion.

For example, if we try to store a string in integer datatype.

From the given options,

int('four') will produce a ValueError because "four" is a string and cannot be converted to integer data type.

Hence,

Option 3: int('four') is the correct asnwer

User Tommy Adey
by
5.8k points