15,175 Topics

Member Avatar for
Member Avatar for Yeen

I ran into a something I did not expect when making a small program. I'm not including the whole program, just exemplifying the stick in the wheel, as it's part of a homework assignment. I'd just like some clarification on why the last "x = 1" is ignored. [CODE] x …

Member Avatar for pspwxp fan
0
98
Member Avatar for prbalamurugan

Hi to all, I am new to python environment,i got the knowledge about REST and python.. But i didn't know how to implement it... I requesting you to give me some suggestion...

0
39
Member Avatar for zyrus001

I have a wx.ListCtr: [CODE] self.resultList = wx.ListCtrl(self.rightPanel, -1, style=wx.LC_REPORT | wx.EXPAND) f = self.GetFont() dc = wx.WindowDC(self) dc.SetFont(f) i = 0 for items in (SEARCHPARAMS): self.resultList.InsertColumn(i,items) width, height = dc.GetTextExtent(items) self.resultList.SetColumnWidth(i, width) i +=1[/CODE] I'd like to populate the ListCtrl from a dictionaries contained within an object list. I …

0
48
Member Avatar for krishna_sicsr

Hi All, I need to parse the out from following output: I need to get the adapter detail after the heading "System Adapter Configuration:" This adapter detail is in 2nd cloumn like ACPI_IA64_P, ACPI_IA64_B, XBUS and PCI. I have marked the desired output in [COLOR="Red"]RED[/COLOR] color. Please help me in …

Member Avatar for krishna_sicsr
0
137
Member Avatar for mms6

I want to allow certain characters to a string For example I want strA to contain either 'A' or 'B' or 'C' or 'D' How do I do that, help would be greatly appreciated. Thanks strA = 'A' or 'B' or 'C' or 'D'

Member Avatar for mms6
0
86
Member Avatar for scrace89

I'm having a tough time figuring this out. we need to fill in the blanks [CODE]import ____________ def wordCount(): lineCnt = 0 wordCnt = 0 charCnt = 0 list = [] ______________ = _______________("Enter the filename : ") file = ________(filename, __________) for _________ in file: ____________ += 1 list …

Member Avatar for vegaseat
0
381
Member Avatar for nevets04

[code] def a(classname,highdamageweaponname,lowdamageweaponname,ldmgname,hdmgname,yourhealth,enemyhealth,ldmgspellname,hdmgspellname): import os import random os.system("clear") monsters = ['cyclopse', 'duck', 'dragon', 'wizard', 'magician'] randommonster = random.choice(monsters) print "Class: %s" % classname print "1) %s (More damage, but less armor)" % highdamageweaponname print "2) %s (Less damage, but more armor)" % lowdamageweaponname a = int(raw_input("You are battling a %s …

Member Avatar for nevets04
-2
310
Member Avatar for rush_ik52

hey guys.. I wana implement a stop watch in python... The timer turns on when my program starts and continuesly shows the time spent until the end of the program.. Can someone please help me with this..??

Member Avatar for snippsat
0
821
Member Avatar for bdesc100

I am trying to add a path to sys.path fix an error importing numpy. If I do: [CODE]import sys sys.path.append('/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages') print sys.path[/CODE] then path that I just added shows up and import numpy works. However, if I restart IDLE and try to import numpy again, I get an error. How …

Member Avatar for vegaseat
0
4K
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
128
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
164
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
144
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
350
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
71
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
855
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
60
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
138
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
105
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
147
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
110
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
45

The End.