I wrote a function with x value which can take either 1 or 2. And depending on x, I created another function inside this function, in which it checks the x value. When x == 1, then he makes return 1, and when x == 2, then return 0. Question I want to check the function for example if the function is exactly 1 then do something, otherwise do something else.
import random def coin(x=random.randint(1,2)): if x == 1 : print('Head') else: print('Tail') def flip(): a=None if x == 1: a=1 elif x == 2: a=0 flip() type how to check return for example:
if coin () == 1: print (+)
Something like this . Or tell me how to do it right.