15,181 Topics
| |
Return True if the bases represented by the str parameters form a base pair and False otherwise. Each str is a single character: one of 'A', 'T', 'C', and 'G'. is_b_pair(letter,DNA): new_letter ="" new_DNA += new_letter if new_DNA in [GAATTC,AAGCTT]: return True else: return False please help | |
Ok so I'm trying to write a little python program that simply monitors the total bandwidth usage of a computer, and have no idea how to do this. So if someone can just point me into the general direction of how to do something like this it would be great … | |
If the str is a palindrome, return True; otherwise, return False. Punctuation, spaces, and other non-letters are ignored; their presence or absence should have no effect on the result. Uppercase letters are considered to be equal to their lowercase equivalents. So my question basically is... How do I "ignore" the … | |
If I have a string "Mary had a little lamb" and a list of strings such as ["Mary", "Bob", "Steve"] how to use a loop to search this string for items in the list? | |
OK I have a search script that suppose to search for information in my database. The problem I having is that I want the user to be able to enter a last name to search. The only part that is giving me problems is this part, I'm stuck on this … | |
Hi all.. I am new to Python and I am here seeking help. Actually, I'd like to run a DOS executable file from Python. The DOS excutable file requires 5 inputs from the users, and I have tried some coding which apparently doesn't work. Can anyone help? Here is my … | |
i am new to PyGtk. i don't know how to get realtime update on gtk. such as downloadmanagers show's every time the speed changes. here is my. in this code the "f='/home/tree.txt'" is a log file .this file regularly updated by another thread. i want to add the file contents … | |
I've just started learning Python but have hit a little issue when instancing a class. I seem to get errors like: AttributeError: type object 'Stuff' has no attribute 'a' or: AttributeError: class 'Stuff' has no attribute 'a' Clearly I'm missing something fairly fundamental :/ A quick test program shows what … | |
| Hey All, I have made a program called "Pymailer", I have even made a GUI version... now what I want to do is to convert it to .exe format... how do I do it? I googled for some info, but in vain! |
Hello guys I want to convert an integer to a hexadecimal string examples lets say i have an integer value 1 i want to convert it to 0001 integer value of 16 => 0010 245 =>00F5 and so on the string must have a length of 4 digits my code … | |
I'd like to make a bogus Windows window pop up asking the user to choose between energy settings (better performance vs. better energy savings). This is for a social psychological experiment about ecologically sustainable behavior, so it's completely legitimate; it's approved by an ethical board, and the participants will be … | |
Okay, I wrote a simple calculator, not in GUI form, but a calculator for simple stuff. So I'm wondering, would this layout be considered OO? I think this is how it works. Now I do know that I didn't use an object to handle the class since it just wasn't … | |
Hi Friends, I need to write a piece of code to identify if an Excel session(the process which is listed in the Task Manager) is already running or not?. Can anyone guide me with this? Any help will be much appreciated! Regards, Dinil | |
[CODE]#include <iostream> #include <string> #include "Python.h" using namespace std; #define py PyRun_SimpleString(pythonCommand.c_str()) int main() { string pythonCommand; //Python started Py_Initialize(); pythonCommand = "import sys";py; pythonCommand = "from math import sqrt";py; pythonCommand = "sys.setrecursionlimit(1000000)";py; //factorial function pythonCommand = "def ft(x): return(1 if x==0 else x * ft(x-1))";py; //equation using function pythonCommand … | |
I have a Syncing program that, while idle, crawls through the sub-directories of the sources and destinations saved to a 'sync profile'. It starts a new thread and walks the directories calculating the divergence between the sources and directories. I want this feature to have little impact on computer performance … | |
I have to make some bookmarks so I quickly knocked up the script below and ran it. It created the files fine but with a with an incorrect ip in the second file The second bookmark created should be named York.URL which it is but the ip address of the … | |
First Question: Use the following variables: i , lo , hi , and result . Assume that lo and hi each are associated with an int and that result refers to 0 . Write a while loop that adds the integers from lo up through hi (inclusive), and associates the … | |
The following code should return the longest odd-length palindrome in a string centered at the index. So in a string 'asradarer' it should return 'radar'. Can you explain to me what the problem here is? [CODE]def get_odd_palindrome_at(word, index): num = 1 new_word = "" while index < len(word): if word[index … | |
My file directory is full of filenames with "male" and "female" being part of them. I want to loop through the directory and distinguish between the two. [CODE] import os maleDataSets = 0 femaleDataSets = 0 females = [] males = [] filePath = "Dataset/parameter feature vectors" for file in … | |
I the following program, can someone please explain these two lines. "def __init__(self, master):, & Frame.__init__(self, master)" One other thing. Shouldn't the method "update_count" use a return to return the new count? thanks. [CODE]# Click Counter # Demonstrates binding an event with an event handler from Tkinter import * class … | |
Heres the situation so far.I'm in 9th grade and I've been programming in python. I enjoy python however, my high school doesn't offer any courses for python. In 11th and 12th grade, I can take C++. So here's my question: Should I: A) Learn python for the next to years … | |
Hi Everyone, Sorry if this has a totally obvious solution. I am trying to write a simple cows and bulls game; the program generates a secret number, the player has to guess it, the program then compares the guess to the secret number and tells the player that either they … | |
I have program than finds the minimum temperature of every month, but i can't find a way for it to find the minimum temperature that is higher than 0, i can't just use min() cos if the month has temperature that is lower than 0 it is also counted. | |
So I'm interested in learning about data validation. Especially in Python. Python all ready has several common idioms for data validation. There are several statements that evaluate data. For instance, isinstance(object, classinfo) will check that the given object is an instance of the class or type in classinfo. One idiom … | |
Hello everyone, new programmer here. In my class we have an oppurtunity to make up credit on a previous homework by modifying a program if we got any of it wrong. The problem for the progam was: Problem #4. Write a program to solve the following problem. Find a word … | |
| I am trying to specify which variables a function should return. The purpose of this is to allow the function to return different sets of variables according to the requirements of another function, in order to make things more efficient (rather than always returning all the variables): [CODE] # Python … |
I want to call another object's methods from another object, and I have no idea how. Can someone please help me? Thank you. | |
Hi, I'm looking for a little help with the function "getattr". Here's my code: [code=python]class MyClass: def __init__(self): trycmd = getattr(self, "cmd_testing") try: trycmd() except: print "Fail." def cmd_testing(self): print "Victory!" obj = MyClass()[/code] So, when I run this code, I get the output "Fail.". I'm not sure what I'm … | |
I am new to Python and am trying to marry a Python module with a CGI interface. I understand a little of both but not how they work together. I created a class called Vehicle and (using IDLE) and am able to import it and set the year, make, and … | |
Alright, this is how my newest program looks like: [CODE]import math def main(): print('This program finds the real solutions to a quadratic') print s = float(input('Please enter the coefficients (a,b,c): ')) a, b, c = s.split(',') discRoot = float(math.sqrt(b * b - 4 * a * c)) root1 = (-b … |
The End.