Ask your own question, for FREE!
Computer Science 23 Online
OpenStudy (anonymous):

lets say I'm defining a funtion to def wes(x): how can i run the funtion i tried wes() but it doesnt seem to work also how can i access my file through pthon shell do i just use include filename.py

OpenStudy (rsmith6559):

wes(), by that definition requires one argument. wes() doesn't have any arguments. Your code would need to call: wes( "some value of the correct type for x" ) There are a few gotchas accessing your file from the shell. First, the location of your file, if it's in the same directory that you were in when you started the shell, it'll be simpler. Second, you're going to run into namespaces. If you've used, say sys, you're half way there. To use your function from a file, let's call the file "wesFile.py", you can: import wesFile To call your function: wesFile.wes( x ) You can also import it into your current namespace with: from wesFile import wes and call it: wes( x ) Both of these assume the same directory.

OpenStudy (anonymous):

Run "wes(x)". The wes function requires an argument. In terminal run "python file.py"

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!