There's a main function, inside which the entire operation is done. Inside it, there's an if statement. I want to define a function inside that if function only if that if is satisfied. The compiler should proceed to the function defined in it and 3/4 of the program depends on the operations inside the if. When I run the program, the statements above if only is getting executed.
eg:
def manage():
name=raw_input("Enter name")
pass=raw_input("Enter password")
conf=raw_input("Confirm password")
if(pass==conf):
print"You can proceed!!!"
def proceed():
#here rate is calculated
print rate
manage()#at the very end
the statements above the if is getting executed only.the function inside if is not getting executed.i gave the statements in the else,but its not coming. is it possible to define function inside an if? if not,is there any package we should import? or is there some other way?
if, you just defined it ! if you want that you need to call it , withproceed()ifblock.proceedwill be created ifif(pass==conf)comes true. But just like you called manage function the same way you need to call proceed funtion too.