0
votes
2answers
62 views
Python more functions
I would like to separate this into several smaller functions in order to make it look tidier and easier to read, but whenever I try this I cannot seem to get it to work. Any help would be appreciated.
...
0
votes
5answers
51 views
Correct filter function [closed]
def isUpper(x):
if ord(x)>64 and ord(x)<91:
return True
else:
return False
def isLower(x):
if ord(x)>96 and ord(x)<123:
return True
else:
...
0
votes
2answers
36 views
Using a variable from a function outside the function
Im writing this basic Tk program that can open text documents but i can seem to get it to work
Here is my code:
from Tkinter import *
from tkFileDialog import askopenfilename
def openfile():
...
0
votes
0answers
34 views
Python - Function to open a picklefile?
Suppose I want to write a code that interconnects one function to another. And in each function, there is an argument to use the previously written cPickle file. For example:
Function 1 takes 2 ...
0
votes
0answers
54 views
getting started with cython by using cdef
I dont understand how to setup and run code with cython.
I added cdef, double, etc to pertinent pieces of my code and imported cython but when I run the code, it says
Edit
Redefining the question ...
1
vote
1answer
30 views
Error returning structure from dll function in python
I have a dll written in C exporting this function:
typedef struct testResult_t {
int testId;
int TT;
double fB;
double mD;
double mDL;
int nS;
int nL;
} TestResult;
...
-1
votes
1answer
27 views
Why are some of the functions missing when I call a module I created from another script?
I'm working with a module I created a while ago, where I have a bunch of functions I keep re-using. Today, I added a new one but when I try to call it from another script, I got the error ...
1
vote
1answer
29 views
How can I call a Python instance's unspecific method by its member function name?
class worker:
def foo(self):
pass
def foo1(self):
pass
def foo2(self)
pass
The worker instance will have several foo* format member function(the number of foo* ...
-2
votes
2answers
30 views
Globals not dividing?
MAX=100
CURRENT=50
def divide():
global MAX
global CURRENT
print float((CURRENT/MAX))
divide()
Can someone tell me why this prints out 0.0?
2
votes
1answer
38 views
splitting up strings to x amount of characters
I am trying to make a decrypter that decrypts code from the encrypter I made. I am getting this type error when I run the code though
getcrypt = ...
1
vote
1answer
38 views
Trying to add a number to a variable in Python, keeps resetting the variable back to what it was originally [closed]
def start():
number = 0
prompt = raw_input("> ")
if prompt == "1":
number += 1
print number
start()
else:
start()
start()
My output:
Enter ...
0
votes
1answer
53 views
Creating a matrix based on 3 inputs
I need to create a 2 by n matrix
x y
1 x1 y1
2 x2 y2
3 x3 y3
4 x4 y4
5 x5 y5
. .. ..
n xn yn
it needs to be created from a function with 3 inputs: x,y, and n, let us call it ...
0
votes
2answers
55 views
why is my function not always returning the correct list?
I have a function that takes two inputs, and will return an array of tuples where the two numbers in a given tuple have the exact same ratio as the two numbers given to the function!
So everything ...
0
votes
2answers
36 views
How to get a menu checkbutton to call a function in Python + Tkinter?
so, I'm now in a personal project (just to try myself) with python + tkinter. It is a encrypter, which means that it gets a piece of text and encrypts it using some famous cyphers (like the numerical ...
-2
votes
4answers
54 views
calling a second function within another function
I would like to open a file using the a_reader function. I would then like to use a second function to print the file. I want to do this because I would like to be able to call the open file function ...