error when executing the program python -
def main(): get_value =get_display_info('5 6 0','7 0 0 0 5') print(get_value) def get_display_info(dice_to_roll_again_str, dice_set_aside_str): length1 =len(dice_to_roll_again_str) d = dice_set_aside_str if dice_set_aside_str == none: return 0 else : return len(dice_set_aside_str) if length1 , dice_set_aside_str > 0: return "(dice roll again:" + str(dice_to_roll_again_str) +','+ "dice set aside:" + str(d) + ')' elif length1 > 0: return "(dice roll again:" + str(dice_to_roll_again_str) + ')' elif dice_set_aside_str > 0: return "(dice set aside:" + str(d) + ')'
why program stop executing upon reaching statement?
if length1 , dice_set_aside_str > 0:
your code return unconditionally after block:
def get_display_info(dice_to_roll_again_str, dice_set_aside_str): length1 =len(dice_to_roll_again_str) d = dice_set_aside_str if dice_set_aside_str == none: return 0 else : return len(dice_set_aside_str)
Comments
Post a Comment