Skip to content

Instantly share code, notes, and snippets.

@Pierian-Data
Created March 1, 2018 17:12
Show Gist options
  • Save Pierian-Data/5c832d8e481557c12eab2565013baec4 to your computer and use it in GitHub Desktop.
Save Pierian-Data/5c832d8e481557c12eab2565013baec4 to your computer and use it in GitHub Desktop.
def myfunc(x,y,z):
if z:
# print(x)
return x
else:
# print(y)
return y
@anantharajp
Copy link

anantharajp commented Sep 18, 2023

def myfunc(x,y,z):
if z == True:
return x
else:
return y

@tulasiranganathan
Copy link

def myfunc(x,y,z):
if z == True
return x
else:
return y

@FabulousCoder226
Copy link

FabulousCoder226 commented Sep 29, 2023

X = 'nkem'
Y = 'nam'
Z = 'afa'

def myfunc(x,y,z):
if z == 'food' :
print(x)
return x
else:
print(y)
return y

@natchaliw
Copy link

def myfunc(x,y,z) :
if z == True :
return x
else :
return y

@pradeepjts
Copy link

def mufunc(x,y,z)

if z:
return x
else:
return y

@bsnirmalraj
Copy link

def myfunc(x,y,z):
if z:
return x
else:
return y

print(myfunc(1,2,3))

@harshinimamidipalli
Copy link

def myfunc(x,y,z):
if z==True:
return x
elif z==False:
return y

@a-hoque
Copy link

a-hoque commented Jan 5, 2024

def myfunc(x,y,z):
if z==True:
return x
elif z==False:
return y
else:
pass

@kabbo90909090
Copy link

def my_funtion(x,y,z):
if x==True
return z
else:
return y

@Gilad-Shai
Copy link

def myfunc(x,y,z):
if z is True:
return x
else:
return y

@aartipatil7888248909
Copy link

def my_func(xapple,ybanana,zchikku):
if zchikku:
return xapple
else: ybanana:
return ybanana

@zuhaibfarooqui92
Copy link

def myfunc(x,y,z):
if z == True:
return x
elif z == False:
return y

can anyone explain why the z is left blank in some answers above, how does that work?

@aartipatil7888248909
Copy link

aartipatil7888248909 commented Jan 25, 2024 via email

@Hooyog
Copy link

Hooyog commented Feb 7, 2024

def myfunc(x,y,z):
if z==True:
return x
elif z==False:
return y
else:
pass

@Adithya4560
Copy link

def myfunc(x,yz)
if z == True:
return x
elif z == False:
return y
else:
pass

@VictoriaPoint
Copy link

def myfunc(x,y,z):
if z==True:
return x
elif z ==False:
return y

    pass

@Vovapro1122
Copy link

def myfunc(x,y,z):
if x:
print(x)
return x
elif z:
print(z)
return z
else:
print(y)
return y

@m-chandu
Copy link

m-chandu commented Mar 6, 2024

def myfunc(x,y,z):
return x if z else y
myfunc(32,'Hello',True)

@Aixa-Cal
Copy link

def myfunc(x,y,z)

if z:
return x
else:
return y

@sudheerkilani
Copy link

image

@sudheerkilani
Copy link

image

@Phan-Hoangg
Copy link

def myfunc(x,y,z):
if z:
# print(x)
return x
else:
# print(y)
return y
result = myfunc(10,12,True)
print(result)
result1 = myfunc(10,12,False)
print(result1)

@Jarbo1225
Copy link

def myfunc(x,y,z):
if z ==5:
#print("x+y")
return x+y
else:
print("y+z")

result = myfunc(1,3,5)

4

@RogelioDaniel
Copy link

def myfunc(x,y,z):
if z == True:
return x
elif z == False:
return y

@shrutigitam
Copy link

def myfunc(x,y,z):
if z == 'food' :
print(x)
return x
else:
print(y)
return y
myfunc('nkem','nam','food')

@chiragsalvi
Copy link

def myfunc(x,y,z):
if z == True:
return x
else:
return y

@0xtpsn
Copy link

0xtpsn commented May 16, 2024

def myfunc(x,y,z): if z == True: return x else: return y

@kevin17-86
Copy link

def myfunc(x, y, z): if z: #print(x) return x else: #print(y) return y

@darkh00k
Copy link

def myfunc(x,y,z):
if z == True:
return x
else:
return y

myfunc('Hello','Goodbye',True)

@haneenmuhammed2005
Copy link

def myfun(x,y,z):
if z==True:
return x
else:
return y

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment