14,952 Topics

Member Avatar for
Member Avatar for mms6

My code is [CODE]def is_base_pair(str1, str2): if lens(str1) == 1 and lens(str2) == 1: if (str1 == "A" and str2 == "T") or (str1 == "G" and str2 == "C") or (str1 == "T" and str2 == "A") or (str1 == "C" and str2 == "G"): return True else: return …

Member Avatar for vegaseat
0
126
Member Avatar for msaenz

I have a dicationary [code=python] x={'symbol':LTV,'user':derek,'where':home,'time':night} [/code] Obviously when u print it the dictionary doesnt keep the order you put them in. how do i have a dictionary that has it the way i input them? I looked online, but not sure to you cmp, lambda, etc? Thanks for the …

Member Avatar for vegaseat
0
163
Member Avatar for Kolz

Return the longest odd-length palindrome centered at the int index in the str. Assume that the index is valid, that the length of the str is at least one, and that there are only lowercase letters: no punctuation, spaces, or uppercase letters. I just want to know what this question …

Member Avatar for masterofpuppets
0
134
Member Avatar for bol0gna

I am reading in files containing 238 x 1 feature vectors. Attempting to grab the first 2 numbers in each file to create a 2d plot using numpy. I've got a decent start, just am stuck on how to fill the np array that I want to plot. [CODE] import …

Member Avatar for bol0gna
0
340
Member Avatar for mms6

[CODE]def get_even_palindrome_at(user_input, index): user_input = user_input.lower() user_input = remove_non_words(user_input) start_index, end_index = index, index while start_index >= 0 and end_index < len(user_input): if user_input[start_index] == user_input[end_index]: start_index -= 1 end_index += 1 else: break result = "" count_index = start_index while count_index < end_index: result += user_input[count_index] count_index = count_index …

Member Avatar for Kolz
0
70
Member Avatar for topcat712

Hey there, I've never actually used a forum to ask for help on any sort of project before, but I'm a little stuck.. okay, a lot. =D It's probably something really stupid and minuscule, though. Anyway, heres the project.. I hope it's not too confusing: Write a program that asks …

Member Avatar for snippsat
0
1K
Member Avatar for Gribouillis

Printing a convenient [url=http://en.wikipedia.org/wiki/ANSI_escape_sequence]ansi escape sequence[/url] clears the terminal (if you're running python from a terminal). Similar techniques could be used to print in colors.

Member Avatar for Gribouillis
0
275
Member Avatar for thehivetyrant

Evening there. [B]I need to return an (x,y) tuple of an object, This x,y will be used to help 1 object calculate where the other object is and move towards it.[/B] My problem is that both the objects need to know the others' x,y. (i'm unsure how to get the …

Member Avatar for thehivetyrant
0
846
Member Avatar for vnproduktionz

im taking a class in python but i just cant keep up with the curriculum. Some things confuse me so i was wondering if anyone have any websites or anything that can help me get through python or at least help me understand it easier. the book im using right …

Member Avatar for vegaseat
0
128
Member Avatar for hencre

hi, Im calling Oracle 10g stored proc from python 2.6. 1. How do I pass String VArray (list in python) to stored proc ? 2. How do I return cursor from Oracle stored proc ? 3. How do I return list of strings from Oracle stored proc ? My Oracle …

0
59
Member Avatar for vnproduktionz

kind of a basic question but i cant seem to figure it out. well i have a list and i split it up using the split function but now im confusing how i can use one string and divide it to another. i tried turning it into a int or …

Member Avatar for vnproduktionz
0
164
Member Avatar for vnproduktionz

[CODE]reply=float(raw_input("Enter your choice: ")) if reply!=1 or reply!=2: print "Not a Valid Choice" [/CODE] i cant use while loops other wise i prob wouldve done so. Basically im trying to get the user input to only allow the numbers 1 or 2. anything else should give a not a valid …

Member Avatar for vnproduktionz
0
137
Member Avatar for pyprog

Hey, everyone. I know how to strip certain characters from a string using for loop. Can you give an example of how that can be done with the use of while loop?

Member Avatar for Gribouillis
0
104
Member Avatar for theclash57

So i have a h/w assignment due tomorrow, and i have tried to work on it, but as usual, python frustrates me. Here is the assignment: [url]http://www.cs.gonzaga.edu/depalma/courses/cpsc121/assignPython/asgn5.pdf[/url] and for part two, here is the link for example26 it says to use: [url]http://www.cs.gonzaga.edu/depalma/courses/cpsc121/examplesPython/example26.py[/url] So i tried working out the first part …

Member Avatar for theclash57
0
91
Member Avatar for mms6

I need help with my Palindrome code For some reason, I cannot seem to convert the text into lower case letters and I cannot seem to ignore spaces and commas and periods and so on. Here is my code [CODE]def is_palindrome(user_input): i = 0 result = True while i <= …

Member Avatar for mms6
0
96
Member Avatar for babsbj

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

Member Avatar for strider1066
0
120
Member Avatar for Freakazo

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 …

Member Avatar for Freakazo
0
81
Member Avatar for Kolz

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 …

Member Avatar for masterofpuppets
0
138
Member Avatar for pyprog

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?

Member Avatar for masterofpuppets
0
109
Member Avatar for Megabyte89

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 …

Member Avatar for strider1066
0
212
Member Avatar for EvanGolder

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 …

0
44
Member Avatar for baskar007

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 …

Member Avatar for The_Kernel
0
702
Member Avatar for twoshots

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 …

Member Avatar for twoshots
0
119
Member Avatar for sravan953

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!

Member Avatar for sravan953
0
1K
Member Avatar for iamai

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 …

Member Avatar for iamai
0
623
Member Avatar for aot

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 …

Member Avatar for jlm699
0
101
Member Avatar for AutoPython

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 …

Member Avatar for AutoPython
0
205
Member Avatar for dinilkarun

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

Member Avatar for dinilkarun
0
143
Member Avatar for ebrutekim

[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 …

Member Avatar for ebrutekim
0
174
Member Avatar for ihatehippies

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 …

Member Avatar for ihatehippies
0
115

The End.