mardi 4 septembre 2018

Why do I get this error? '<=' not supported between instances of 'float' and 'str'

This part of code is problematic:

if(a <= 2*BB and b == 'NO'):

I get this error:

TypeError: '<=' not supported between instances of 'float' and 'str'

I thought that the evaluation would go like this:

  1. a <= 2*BB will give either true or false
  2. if it's true, the condition after 'and' will be tested, which again gives true or false
  3. the whole expression becomes either true or false

I don't see how I am using '<=' between 'float' and 'str'. I am pretty sure that both 'BB' and 'a' are 'float'.

Where is the problem?

Aucun commentaire:

Enregistrer un commentaire