15,190 Topics

Member Avatar for
Member Avatar for THEPalletizer

Having issues with my English to PigLatin Converter. I can get the code to execute correctly on one word but once i do 2 or more words it adds the first letter [0] + 'ay' to the last word in the line.... any suggestions? [CODE]def main(): # Create a list …

Member Avatar for THEPalletizer
0
394
Member Avatar for theraggamuffin

Hey i'm trying to draw this patch in python 3.2. As you can see I can get it to draw the top row, but I cannot get it to truncate the rectangles at the left and right hand side, and I cannot get it to repeat itself... Please Help :)! …

Member Avatar for theraggamuffin
0
283
Member Avatar for jdm3

Hello everyone, I'm working on an assignment that requires a game that drops multiple objects that need to be caught. I'm using multiple classes and the current one is raising a type error. " File "C:/Users/Joe/Documents/School/I-210/Final/game.py", line 118, in main gift = Present() TypeError: __init__() takes at least 2 arguments …

Member Avatar for jdm3
0
831
Member Avatar for effBlam

How am I able to open the contents of a text file into a GUI with each character in the text being an individual button. Say the text file contains 25 characters that are either "A" or "B" in random order. The text file also have 5 rows with which …

Member Avatar for bawakrbs
0
194
Member Avatar for bellarc

I am attempting to remove instances of a character from a txt file with python using the following code: [CODE]import fileinput for line in fileinput.FileInput("test.txt",inplace=1): line = line.replace("^M","") print line[/CODE] and get the following error: File "par.py", line 6 line = line.replace(" ^ SyntaxError: EOL while scanning string literal I …

Member Avatar for woooee
0
332
Member Avatar for hovestar

I have a problem calling up my compturn() function. Here is my code: [CODE]import random def compturn(): print 'Computer turn:' comp = str(random.randint(1, 9)) if comp == a: compturn() elif comp == b: compturn() elif comp == c: compturn() elif comp == d: compturn() elif comp == e: compturn() elif …

Member Avatar for woooee
0
202
Member Avatar for Sarcasm

Hi, I am starting out with python coding and was looking for some feedback. Constructive Criticism please. Here is my code for game "Word Guess". [CODE] # Word Guess # # Word guess, is a game where the user has five chances to ask # the computer if a certain …

Member Avatar for Sarcasm
0
213
Member Avatar for csterling

I am trying to create a buffer on a shapefile using python's GDAL/OGR module. I'm not sure where to take the code from here...ideally I would like the buffered file to be a new file. All the documentation I found confused me and I thought maybe someone here could help! …

0
62
Member Avatar for slash16

want to do: [ICODE]dict = {'1': ['a'],'2': ['a', 'b', 'c']}[/ICODE] invert it to: [ICODE]inv_dict = {'a':['1','2'],'b':['2'],'c':['2']}[/ICODE] i know the one liner, if the dict was one to one, [ICODE]inverse = dict((d[k], k) for k in d)[/ICODE] can I modify this to work if it was not one to one? My …

Member Avatar for TrustyTony
1
2K
Member Avatar for ppotter3

Hello! I am currently looking for some help or ideas in a specific area of Python programming. The project I am having problems with pertains to python print drivers, and printing in a Linux OS. I had originally wanted to find a way (if possible) to write a python print …

Member Avatar for ppotter3
0
338
Member Avatar for rslepoy

Hi, I'm using SAS regular expressions to read a large text file with numbers and characters, and may be up to 500 lines of text in the file. I would like to extract certain key words, specifically, weight quantaties and measures, i.e. kilos or lbs. Each line of text is …

Member Avatar for rslepoy
0
331
Member Avatar for the_azn_invasio

this is my code but i couldnt get phase 2 to print out can anyone help me please? thank you! [CODE] import sys import string NUM_ARGS = 3 GLOBALSTACK = [] TAG_STACK = [] # getFile() Gets a valid file name # Input: None # Output: fileName, the name of …

Member Avatar for woooee
0
294
Member Avatar for sneekula

I need a function that returns True or False if an integer n is a prime. Any 'high speed' thoughts?

Member Avatar for wallars
0
1K
Member Avatar for Gribouillis

This snippet defines a function walk() which generically performs a depth-first traversal of a tree, using preorder, inorder or postorder rules. Here, genericity means here that there are no hypotheses on what the tree nodes are or the implementation of the tree. Walk() only needs an arbitrary object used as …

Member Avatar for Gribouillis
2
1K
Member Avatar for AdampskiB

I'm attempting to create a number square when it's using a parameter. Whatever the user enters in the parameter it will display something like this (using 4 as an example): 4567 3456 2345 1234 I've come up this so far: [CODE]def numberedSquare(n): for a in range(n, 0, -1): print(a, end="\n") …

Member Avatar for techie1991
0
165
Member Avatar for Beary21

I'm trying to login to Valve's Steam website, but without any luck my 2 different scripts aren't working. Help please!? Any script I find on the web appears to be outdated. [CODE] import urllib, urllib2, cookielib, webbrowser data = urllib.urlencode({ 'action': 'doLogin', 'goto': '', 'steamAccountName': "****", 'steamPassword': "****", }) # …

0
203
Member Avatar for atwomey

Hello, I am new to Python with only a beginners class completed. I am trying to change code that I have already used to compare line segments. I now want to compare two different polyline shapefiles to eachother and export the intersections as a point shapefile. I'm having trouble understanding …

0
86
Member Avatar for daniel5126

Hello! I'm incredibly new to Python and I hope I'm not asking a dumb question. I also hope I can explain this clearly. 1. I have two lists that each give user activity in one column, and userID in the other. The two lists correspond to consecutive time periods of …

Member Avatar for TrustyTony
0
98
Member Avatar for next_tech

Hi Guys, I am making a board game, where there is a 3x3 grid and the user enters a row and column and it should put an x in that spot on the grid and ask for the user for another location, until they enter 0 to quit. Here is …

Member Avatar for woooee
0
111
Member Avatar for stefh

Hi everyone :) Title says it all... I'm trying to bind events to a wx.GenericDirCtrl. I've visited more than 20 web sites but i haven't found how to do it. I've tried different manners but it doesn't work as i expect it to. In some case my control is seen …

Member Avatar for stefh
0
624
Member Avatar for telmo96

Hey mates, it's me again. I'm trying to develop a small application, but I'm not sure how to put two icons in the same toolbar, probably theres another way of creating toolbars instead of "self.toolbar", I'm not sure. Check my code: [CODE]import sys from PyQt4 import QtGui class Routine(QtGui.QMainWindow): def …

0
89
Member Avatar for wkarl

i want to Display my QTableView insid QTextEdit ? can i do this thing ?? if i can how i can do it ?

0
86
Member Avatar for asong

Your task is to write a program that checks html files, (web pages) to determine whether the embedded XHTML tags are balanced. Balanced tags are necessary for the file to be a valid XHTML file as explained above. The first phase takes care of reading the file and finding all …

Member Avatar for asong
0
225
Member Avatar for mr.ch

basically here is a code, what the question asked to do is to create a graph in quickdraw using the data given to us. now the problem is when i run the program it gives me a few errors. i am new at this and any help would be appreciated. …

Member Avatar for mr.ch
0
105
Member Avatar for hovestar

I am a new programmer and I wanted to start by writing a Tic-tak-Toe program I have more to add but here it is so far. [CODE] import random board = """ 1 | 2 | 3 ---+---+--- 4 | 5 | 6 ---+---+--- 7 | 8 | 9 """; …

Member Avatar for TrustyTony
0
8K
Member Avatar for huntaz556

Hi everyone ! i havent posted in a while i guess i just took a break O.o But i am having a problem i designed a UI in qt designer and then did [CODE]pyuic4 -x backup.ui -o backup.py[/CODE] That worked perfectly i can execute it and i have a nice …

1
91
Member Avatar for AdampskiB

Hello again! I'm having trouble trying to double the value of my coordinates in my point. The object is to create a pair of eyes and their position is identified by clicking a point in the graphic window which would allocated the centre of the left eye, and the second …

Member Avatar for AdampskiB
0
236
Member Avatar for wkarl

hello everyone , i need to make a borders for my printing report and i need a function that move my logo into middle of my report at first line , how i can do these things in Qt4 ?? i write thia code using PyQt4 [CODE]QtCore.QObject.connect(self.pushButton_5,QtCore.SIGNAL(_fromUtf8("clicked()")),self.Delete) def Delete(self): self.printer …

Member Avatar for wkarl
0
192
Member Avatar for Number1000

Hi guys, thanks for any help offered. I am attempting to ask a user for a height and width value - which need to be integers between 5 and 10 for each (height and width) I also need the user to select 3 different colours, out of a predetermined list …

Member Avatar for WolfShield
0
140
Member Avatar for lawltman

So here's my code. What I want is for the player to move down, and while it's moving down, to cycle through images in the sequence (0, 1, 0, -1, 0...) but it doesn't do that. [CODE]import pygame, time pygame.init() Screen = pygame.display.set_mode((400, 400), 0, 32) pygame.display.set_caption('Walk around') GREEN = …

Member Avatar for DrakeMagi
0
243

The End.