15,175 Topics
| |
Hi I try to copy a list to another list but it dosent work[code] def kopi(x,y): i=0 for i in range (1,len(x)-1): x[i]= y[i-1] i+=1 print y [/code] I dont know what is the problem with my code. thanks alot for your help. | |
Hey. I'm working on a simple project that requires a way to find all the empty grid cells accessible along a path that's <= n cells long (an analogy would be TBS movement), and I've got an [i]almost[/i]-working piece of code for it. Here's the function I wrote: [code=Python]def findArea(distance,origin,gridUsed,emptyChar): … | |
Hi to all, after two months I decided to give Python one more chance. Here is a little code snippet about counting number of words in text file. (Under word I assume any combination of letters and numbers delimited by standard separators " .,\n\t" [code] file = open ( "Test.txt", … | |
Hi guys, I have a simple question. I'm trying to import my modules from a different folder (the different folder is in the same place as the the program I'm importing from), but I don't know how. I've looked on Google, but I've had no luck so far. My question … | |
I'm new to Python and I'm working on a craps game. I got the basic code down, but I need to simulate a total of 200 games and track the number of wins. I need a counter in my program, but I can't figure out how to do this. Here's … | |
I'm currently creating a text based adventure game using python. One of the features in the game is that when you enter a room an enemy attacks you and takes off some of your health. I have an If loop to control if there is an item that you need … | |
hello, i'm a newbie programmer (and to python, double trouble :) and running into issues reading and writing files. i'm successfully running the code below to manipulate and remove the first few lines of a text file. The text file (file1.txt) is approx. 329kb but when i run the code … | |
I'm a linguist (Python newbie) trying to use Python to help me with some simple NLP processing. I have extracted verb + preposition + VBG triples from the British National Corpus, so I have large csv files containing stuff like this: plan,on,selling criticised,for,getting opened,after,receiving were,in,identifying visited,before,returning recruited,from,including attended,by,including given,by,joining ... … | |
Hi all I am brand new to python so if anyone could help that would be great. The trouble I have is that I am trying to call two other programs from within a parent program, and pass arguements to these children programs. Here is my code so far, but … | |
Enter initial capital: 2000 Enter percentage: 6.6 Enter number of years: 4 After Year 1 you’ll have 2132.0 dollars After Year 2 you’ll have 2272.71 dollars After Year 3 you’ll have 2422.71 dollars After Year 4 you’ll have 2582.61 dollars In 4 years, a total interest of 582.61 dollars is … | |
I don't know where to put quit.png. This result in errors. Is it put on SPE folder or somewhere in python? or Just in same directory as saved file? I appreciate your help! Steve Code import wx class MyFrame(wx.Frame): def __init__(self,parent,id,title): wx.Frame.__init__(self,parent,id,title,size=(700,600)) toolbar=self.CreateToolBar() toolbar.AddLabelTool(wx.ID_EXIT,'',wx.Bitmap('..\icons\quit.png')) app=wx.App() MyFrame(None, -1, 'Simple Toolbar') app.MainLoop() | |
Hi, I am new to phyton and now I have some problems in terminating my while loop. This loop runs infinitely, I tried to print both count and N and yes, the value of count does go way beyond N but the loop is never terminated. I am guessing this … | |
2. List Processing (10 Points) Write a program that asks the user to enter a list with an even numberof integers. The program then has to construct a new list by adding pairs of integers in the list. Hereis an example of a program run, where the user enters the … | |
Hi All, Is it possible to flush the buffer of "popen2.Popen3(cmd)"after some time interval? I am starting a server forever using the popen2 module. After some time the buffer gets full & it stops logging messages. As a workaround to this, I am redirecting the output of 'cmd' to a … | |
I recently bought a book on Python, and I'm working my way through it. However, I've come to a very simple program, but I can't understand a certain part of the code. Can someone explain? [QUOTE]# Print out a date, given year, month, and day as numbers months = [ … | |
Is there something similar to a LIKE function in python? What I'm trying to accomplish is to search inside a string, if it finds specific criteria it sets another variable to a specific value. In other scripting languages I have used a LIKE function to do this but I can't … | |
Essentially, what I want to do is get rid of MIDI files, when creating a sequencer. So, say I have a text file (that would be my pseudo-MIDI): [code]A |----------------| Bb |----------------| C |----------------| Db |----------------| D |----------------| Eb |----------------| E |----------------| F |----------------| Gb |----------------| G |----------------|[/code] As that … | |
hi there, my 1 year old carpet python is eating a jumbo rat every 3 days wat is the next thing to feed after jumbo rats please advise thanks wyno | |
I am using java.util.map to store some data ( one key and two values , per row ) in java and return it to a python function . What kind of a data structre should I use in python to catch it? (btw I am using Jython as a bridge … | |
Hello everyone! This is my first post here, so, hi. ;) So I'm beginning to port (actually, re-write) one of my C games to Python to extend my Python knowledge, using wxPython. Yes, I know of PyGame, but I really want to use wxPython this time. I'm guessing direct pixel … | |
I'm a relatively new Python programmer, but I have all the basics down. Currently I'm working on a program that sends and receives serial input and receives video input. I have gotten this to work in a basic command prompt structured code however I want to be able to implement … | |
Hi, I wanted to ask if somebody could help me on the following problem: I want to check how often a button in python/tk is clicked. I tried the folowing but it doesn't work: [code=python] click=0 def button_clicked(): click=click+1 print click [/code] but this won't work because the variable click … | |
I'm new to creating python extension modules with distutils. I'm trying to create a module that uses the fmodEx audio library on OS X, and I'm running into some trouble. The needed library file is called fmodexlib.dylib. My setup.py looks like this: [CODE] from distutils.core import setup, Extension setup(name='test', version='1.0', … | |
Hi, If I execute the following code I will get the the output as 2. What I need is to execute the string str. Is there a way that I can execute the string str , as it is so I will get the output as 5. [ICODE] def add(a,b): … | |
Write a function that fills in a given matrix with the given numbers so that the sum of all columns and all rows should be equal to the same number. The prototype for the function should be void fillMatrix(int mat[][MAXSIZE], int numbers[], int rowSize, int colSize, int sum); For example, … | |
from livewires import * x= read_number() y= 1234 while x <> y: print read_number() Why wont the loop stop when i enter 1234 ? any help greatly appreciated! | |
I'm new to Python and even new it GUI with Python. I'm using Glade to create my GUI. My problem is that when I click a button in My GUI inter face the GUI freezes until the process is complete. I'm been told that I need to use "threading" to … | |
Hi all! I have a problem with a cycle while and a value list. How to dynamicize them without knowing what are the values in a list? And how do I recall a function ( call in my ex.) with the appropriate value? Thanks Hud [CODE] import tkHyperlinkManager #external lib … | |
Im writing a game and want to know how to write the formula for the winner. So for paper scissors rock, ive written it so the two players enter their choice but i dont know how to write the parameters which show who the winner is. so paper beats rock, … | |
Hi guys, Quick question. Im having some problems with advanced sorting. Say i have the following list: [number] + [text] 3 text_red 7 text_yellow 9 text_blue 1 text_pink 3 text_black 6 text_orange 7 text_white Firstly the list needs to be ordered via the number at the front of the list … |
The End.