15,175 Topics

Member Avatar for
Member Avatar for frank_albers123

I need to write a program that uses the following function [CODE]def pascnext( L ): currentrow = [] if len( L ) == 0: return [1] if len( L ) == 1 and L[ 0 ] == 1: return [ 1, 1 ] else: currentrow += [ 1 ] for …

Member Avatar for jice
0
109
Member Avatar for P00dle

Hi I am ery new to Python. I've only started using it yesterday. Please keep that in mind, as the error might seem simple to you, but I can't understand it. I am trying to run the following piece of code: [code] import re foo = open("PREFIX.txt", "r+") text = …

0
72
Member Avatar for saikeraku

Hi I'm trying to write some functions. This first function is suppose to help shuffle two strings which are the same length into the correct word. So the output would be something like: After shuffling the first string som and the second string trs the word is storms. Here is …

Member Avatar for katharnakh
0
108
Member Avatar for ihatehippies

Here's my problem. I wx application that works great until I close it (leaving the idle editing session open) and then restart it. Then parts of the program see variables that should be things like 'wx.panel' as PyDeadObj .... Once I restart the idle session and re-run the program it …

Member Avatar for ihatehippies
0
138
Member Avatar for pyprog

If I have a file that has a content of this kind: a,b c,d e,f g,h I need to make a list of the letters in the first column, i.e., [a, c, e, g]. I wrote some code which prints these letters but I don't know how to put them …

Member Avatar for snippsat
0
282
Member Avatar for frank_albers123

I am writing a program in python where in the function I input a row in Pascals triangle and the function returns the NEXT row in the triangle. Below is what I have so far and am getting really frustrate...I'm new at this and bad at iterating things. Can you …

Member Avatar for masterofpuppets
0
309
Member Avatar for FengG

Python beginner try to learn pygame. Here is a program I made for random color circles popping out. [CODE]import pygame, random pygame.init() X = 680 Y = 460 def main(): screen = pygame.display.set_mode((X,Y)) pygame.display.set_caption('circles') background = pygame.Surface(screen.get_size()) background = background.convert() background.fill(pygame.color.Color('white')) run = True clock = pygame.time.Clock() while run: clock.tick(30) …

Member Avatar for FengG
0
136
Member Avatar for sneek

Hi, I have a problem because I did not realy get yet when do Py_INCREF or to Py_DECREF. I build a class type that covers a PyObject*-Array. Now I wrote a function like that: [CODE] static PyObject * get_first(MyObject *self) { PyObject *res = NULL; if (!self->size) return NULL; res …

Member Avatar for sneek
0
935
Member Avatar for SMIFMD

Can anybody help me out on creating the ceasar cipher. I am attempting to create the program with several functions, including a function for a password. I think that it adds a few more "bells and whistles" by adding this feature. When I run the script below, what is being …

Member Avatar for masterofpuppets
0
193
Member Avatar for zyrus001

I'm reading in a file and sending the data (once encrypted) to a dictionary, with a hash of the data before and after encryption. I then pickle the dictionary but find the file size is massive compared to the source file size. If I write the encrypted data straight to …

Member Avatar for vegaseat
0
275
Member Avatar for wrobl1rt

I am trying to remove a specific substring from a string... Here are the doctests. I'm just absolutely stumped. Can someone point me in the right direction on where to start? def remove(sub, s): """ >>> remove('an', 'banana') 'bana' >>> remove('cyc', 'bicycle') 'bile' >>> remove('iss', 'Mississippi') 'Mippi' """ def remove_all(sub, …

Member Avatar for vegaseat
0
6K
Member Avatar for krishna_sicsr

f = \ ''' Product: DECNET Node: ALETHA Address(es): 1.1 Product: TCP/IP Node: aletha.ind.hp.com Address(es): 15.146.239.174 ''' lines = f.split('\n') i = 1 ###### To get the IP Address(es) adapter_config = True for line in lines: if adapter_config: # print line import re if (re.match("^Product:\s+",line)): line1=re.split("\s+",line) print line1[5] I want …

Member Avatar for masterofpuppets
0
134
Member Avatar for topcat712

Could someone lend me their brain? :D I thought I had most of it done, until I got an error saying that my 'calcAverage' definition was not defined.. x.x here is the prompt for the program: Write a program that asks the user how many pumpkin weights they have, and …

Member Avatar for masterofpuppets
0
162
Member Avatar for vnproduktionz

[code]# Reading the .csv file energyFile = open("EnergySources.csv","r") stateDict = {} for line in energyFile: line = line.strip() fields = line.split(",") if fields[0] == "State" or fields[0] == "": continue state = fields[0] total = fields[-1] float(''.join(total)) coal = fields[1] float(''.join(coal)) naturalgas = fields[2] float(''.join(naturalgas)) petroleum = fields[3] float(''.join(petroleum)) nuclear …

Member Avatar for vnproduktionz
0
124
Member Avatar for Kezoor

Hello, I begin in Python, and I have the following problem: I retrieve an excerpt of a HTML webpage from the web, and then want the result to be hold in a variable (before being processed by a reg-exp). The function do get the HTML source, but when I assign …

Member Avatar for Kezoor
0
327
Member Avatar for nevets04

Why are there so many people doing c++. I've heard even from c++ coders, that python is better. Is this maybe because c++ has been around longer? What do you think the future of python is? Do you think It will eventually beat out c++?

Member Avatar for jbennet
0
225
Member Avatar for python123

Hi, I am new at Python..i have been asked to create a code for the following item. A user needs to input the 'room number' and 'date' to equal a answer. Room Number: R1, R2, R3, R4, R5 R1 = Dates: 1/01/2000, 01/02/2000, 01/03/2000 R2 = Dates: 01/01/2000, 01/03/2000 R3 …

Member Avatar for python123
0
241
Member Avatar for FengG

[CODE]import pygame pygame.init() def main(): screen = pygame.display.set_mode((640, 480)) pygame.display.set_caption('game') background = pygame.Surface(screen.get_size()) background = background.convert() background.fill(pygame.color.Color('yellow')) box = pygame.Surface((100,100)) box = box.convert() box.fill(pygame.color.Color('red')) t = True clock = pygame.time.Clock() while t: for event in pygame.event.get(): if event.type == pygame.QUIT: t = False elif event.type == pygame.MOUSEBUTTONDOWN: posi = pygame.mouse.get_pos() …

Member Avatar for FengG
1
115
Member Avatar for vnproduktionz

here's what i currently got [code]# Reading the .csv file energyFile = open("EnergySources.csv","r") stateDict = {} for line in energyFile: line = line.strip() fields = line.split(",") if fields[0] == "State" or fields[0] == "": continue state = fields[0] total = fields[-1] float(''.join(total)) coal = fields[1] float(''.join(coal)) naturalgas = fields[2] float(''.join(naturalgas)) …

Member Avatar for woooee
0
103
Member Avatar for Malinka

Dear all, may be someone can help me to find a solution to the following problem: I have a list of patterns (len=5) that are presented as tuples in a list, e.g. patterns = [('w1','X1','w1','Y1','w1'), ('w2','w2','X2','w2','Y2'), ('w2','X2','w2','Y2','w2')] I want to go through all sentences in a text file (one sentence …

Member Avatar for Malinka
0
97
Member Avatar for PixelHead777

At the easy risk of asking something already asked a hundred times... Curses doesn't work for me. I use 2.6 on a Vista It gives an error saying it can't call up a part of the module that came with the program. ... Uhm... help.. T_T ~Pixel

Member Avatar for PixelHead777
0
316
Member Avatar for vandigital

If anyone is interested in helping with creating a mesh exporter I could really use the help. Willing to pay royalties that the exporter will receive when released for purchase. Please email for more information. seth at vandigital dot com Thanks, Seth Richardson

0
71
Member Avatar for tototo

hi, i have an assignment due after 4 hours i'm willng to pay money for solving the assignment here is the assignment link SNIP row data: SNIP i'm serious about paying money and here's my email: SNIP

Member Avatar for jice
-4
141
Member Avatar for Ri0o

hi, i'm new in python programming i'm trying to write a simple program that processes a text file containing grades for a class, extracts the desired grades, count the number of grades in each grade segment and genrate a pie chart for grades,(A1) . [url]http://pages.cpsc.ucalgary.ca/~zongpeng/CPSC231/assignments/A3/a3.pdf[/url] any help would be appreciated …

Member Avatar for Ri0o
-1
121
Member Avatar for sneek

Hello, I've read the python doc (C-API) and was wondering about the two reasons to extend python with C. The first reason is to implement new build-in object types and the second one is to call C-Library functions and system calls. Ok, I think i got the second one but …

Member Avatar for pythopian
0
135
Member Avatar for sravan953

Hey All, I have some code here, the problem is in line 82-83: [code='python'] import smtplib import wx window=wx.App() class pymailer(wx.Frame): def __init__(self): wx.Frame.__init__(self,None,-1,"Py-mailer",size=(500,700)) try: self.s=smtplib.SMTP("smtp.gmail.com",587) self.s.starttls() except: wx.MessageBox("Error 001: Could not connect to the internet, please try again later.","Internet Connection Error") self.panel=wx.Panel(self,-1) menubar=wx.MenuBar() filem=wx.Menu() filem.Append(201,"Quit") self.Bind(wx.EVT_MENU,self.Quit,id=201) viewm=wx.Menu() viewm.Append(202,"About") self.Bind(wx.EVT_MENU,self.About,id=202) …

Member Avatar for pythopian
0
612
Member Avatar for shaan07

Hei..i am novice to programming. How to generate beautiful html pages from a text file. My idea is to generate XML first and then generate it to html. Generated html page should contain all the information that the text file contains..like tables,pics,body,headings. I dont have a clue what to do …

Member Avatar for pythopian
0
129
Member Avatar for simpatar

I want make a program that calculates the cartesian products of two sets. e.g.: This is how i would like the result to look like: >>> Enter two sets to calculate the cartesian product: set([7,9]), set([1,5]) set([(7,1),(9,1),(7,5),(9,5)]) [CODE]def main(): userinput = input('Enter two sets to calculate the cartesian product: ') …

Member Avatar for pythopian
0
176
Member Avatar for lewashby

I recently posted a very small program the uses pygame and the livewires package but was unable to get the program to run. I think the Title for that posting was Graphics Window or something close to that anyway. Since I can't resolve that problem, does anyone have any suggestions …

Member Avatar for vegaseat
0
99
Member Avatar for lewashby

I have installed pygame and livewires but am getting the following error with the following short program that I got from my python book. [COLOR="Red"]AttributeError: 'module' object has no attribute 'init'[/COLOR] [CODE]# New Graphics Window # Demonstrates creating a graphics window from livewires import games games.init(screen_width = 640, screen_height = …

Member Avatar for vegaseat
0
236

The End.