Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # def executes at runtime
- # in python theres is no such thing as a separate compile time.
- # because of this def is a truly executable statement and can
- # be embedded within conditional statements.
- # ex:
- trigger = True
- while(trigger):
- makeFunc = eval(input("Enter 0 or 1 to define function: "))
- if makeFunc == 0 or makeFunc == 1:
- trigger = False
- break
- else:
- print("Invalid input")
- if makeFunc == 0:
- def function(x=1,y=2,z=3):
- return None
- else:
- def function(x="one",y="two",z="three"):
- return True
- x = function.__defaults__
- print(x)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement