+ 1

Getting False instead of True. I'm I missing something?

def expandLevels(score):  if score<= '100':  return 'Proceed to level 3'  if score<= '50':  return 'Proceed to level 2'  if score<= '20':  return 'Back to level 1'  else:  return score expandLevels('15')=='Back to level 1'  False Shouldn't the bool return as True?

3rd Jul 2018, 11:28 AM
penelopy_wahome
penelopy_wahome - avatar
7 ответов
0
you have some logical and syntax error: error-free defintion can be round in the link below 👇🏻 https://code.sololearn.com/cnZsSz3zPvW4/?ref=app
3rd Jul 2018, 11:49 AM
Nikhil Dhama
Nikhil Dhama - avatar
+ 10
Try using and instead of or Like so: if score<= 100 and score > 51: Also, you probably want to convert or make score an integer rather than a string.
3rd Jul 2018, 11:47 AM
jay
jay - avatar
+ 2
aha! thanks jay Nikhil Dhama got it!
3rd Jul 2018, 11:51 AM
penelopy_wahome
penelopy_wahome - avatar
+ 2
penelopy_wahome 1 more suggestion , Try to post your code in the playground section, and share it's link in this section instead of pasting your code here like you did.
3rd Jul 2018, 11:56 AM
Nikhil Dhama
Nikhil Dhama - avatar
+ 2
penelopy_wahome welcome to SL also go through this post 👇🏻 https://www.sololearn.com/discuss/1316935/?ref=app
3rd Jul 2018, 12:04 PM
Nikhil Dhama
Nikhil Dhama - avatar
+ 1
Nikhil Dhama okay, will do. I'n new here, still tryna get my way around. thanks.
3rd Jul 2018, 12:02 PM
penelopy_wahome
penelopy_wahome - avatar
0
Alternatively even doing it this way...still returns as False. def expandLevels(score):  if score== '<= 100 or >= 49':  return 'Proceed to level 3'  elif score== '<=50 or >=20':  return 'Proceed to level 2'  elif score== '<=19 or >=0':  return 'Back to level 1'  else:  return score expandLevels('15')=='Back to level 1'  False What might I be missing?
3rd Jul 2018, 11:31 AM
penelopy_wahome
penelopy_wahome - avatar