I have a script that I wrote earlier and am now trying to create a main page to run this script and others. I understand I have to turn this into a function then call it when nesicary but I am having some trouble in the function portion. Any help and advice is greatly appreciated. Below is the script I am referencing.
#A Python math script
a = float(raw_input("Enter the first number: "))
b = float(raw_input("Enter the second number: "))
print "Your answer is: ",(a*b)
If all you need is to make this code into a script then save this into a file say multiply.py
In this file you would have for example:
then you can call this by: python multiply.py
You can also make this into an importable module by including this line which checks whether or not this module is executing as a main program or not. And therefore it will not run if its imported by another module.