Home > other >  Why is the first to other, eh?
Why is the first to other, eh?

Time:09-23

Which of the following is invalid?

Int (' 20.18 ')

Float (20.18)

Float (' 20.18 ')

Int (20.18)


The answer is int (' 20.18 ')

This topic is not format coercion? Why is the first to other, eh?

CodePudding user response:

The int (' 20.18 ') cannot succeed, other three successfully.

Do not have what problem. String '20.18' is not the integer, after making digital will be prompted to switch failure. Int (' 20 ') can be successful. Int (20.18) can be successful, because it is a floating point integer.



CodePudding user response:

Int (float (' 20.18 ')) can be successful
  • Related