[[def divide(num1, num2):
if num2 != 0:
return num1 / num2
# print(num1 / num2)
else:
print('denominator can\'t be 0')
return divide(int(input('first number:')),int(input('second number:')))
# 1)function zamani None return mikone ke az "return" stefade nakarde bashi.
# 2)age seri aval behesh (4,0) bedi baed behesh (10,5) bedi, in
#funtion 2 bar call mishe, seri aval None ro barmigardune chon returni
# vojud nadare,serie dovom adad ro return mikone .chon return faghat tuye
# "if" hast, age ghesmate else ejra beshe, None reurn mishe
print(divide(4, 0))
# divide(4, 0)
print('this is out of function')]]
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter