Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 13861

function return only last time but not for first two? [duplicate]

$
0
0

[i am calling a function for smash a left over candies after distributed among three persons but I get only result for last...]

def to_smash(total_candies):"""Return the number of leftover candies that must be smashed after distributing    the given number of candies evenly between 3 friends.>>> to_smash(91)    1"""    print("Splitting", total_candies, "candy" if total_candies == 1 else 'candies')    return total_candies % 3to_smash(91)to_smash(1)to_smash(53)

but when i tried with print after return it worked

def to_smash(total_candies):"""Return the number of leftover candies that must be smashed after distributing    the given number of candies evenly between 3 friends.>>> to_smash(91)    1"""    print("Splitting", total_candies, "candy" if total_candies == 1 else 'candies')    return print(total_candies % 3)to_smash(91)to_smash(1)to_smash(53)

Viewing all articles
Browse latest Browse all 13861

Trending Articles