15,185 Topics
| |
Hi, Below is my code. Hopefully it is in the correct format. I would like to know how to ask the user the dir and file name of certain file formats (they are red in the code) and have the program take those answers and put them into the program, … | |
Hi, I've got some c++ code(which i don't have much experience in). I'm trying to write the same code again in python but i'm not having much luck. The c++ code creates an array of x,y co-ordinates: [code=c++] for (double ix = 0; ix < nlat; ix++) { for (double … | |
im doing this code and it needs the absolute value of something here is what i have so far. the formula it gives you is x = absolute value of the square root of radius squared minus the y-intercept squared. this is the bit of code i have so far … | |
I have a subclass with 4 attributes and a subclass with 3 attributes. I want to store my subclass instances in a list. Can I have one list for both of them or do I have to create another list because the number of attributes is different? Thanks ! | |
I can't get the math to work in this program. The 'coinflip' flips a coin until it finds either the sequence heads-tails-tails or heads-tails-heads. My issue is that when I run it, the program will perform way more trials than told, and will only account for a random few in … | |
Hi All, I've got a problem with the python class. I want to create a list of object of type obj() and link them such that the next of one object is the next in its place order. I tried this construction [code] class obj: ------def __init__(self,cargo=None,next=None): ---------------self.next = next … | |
How do you call a method from the main() from a module to print base class attributes. Objects are contained in a list. Module [CODE] def show_employee(self): print 'Employee Name: ', self.__employee_name print 'Employee Number: ', self.__employee_number [/CODE] | |
Basically i'm creating a software to calculate the shorting distance between two graphs. I use dictionarys to organize this information I sort the path's as keys , each key has different paths according to the given inputs through the command: PrintByDistance. The inputs are made through the command: `insert:company:City1:City2:Distance` Company … | |
Hello, I' ve been having the following problem: - my OS is Centos - I have python 2.4 installed (and several packages in it too, like yum, ...) - I have installed python 2.6 - I have taken out all python2.4 executable references in usr/lib so that only python 2.6 … | |
Hello i'm rather new to Python and I was wondering how I could do a menu to prompt the user to choose a number and execute a certain part of code based on his choice. For example: please choose an option 1) 2) 3) then based on users input, it … | |
Hi This is my second post. I am new to python. I hope I have posted my code correctly. I am trying to have Python rewrite the compare.asc file. This file is used with another program called MUST. This is a transmission line program. This program is suppose to compare … | |
I need helping creating a random number of "hello worlds" import random count = 0 while count < 5: count += 1 print "Hello World" dont know where to put the module | |
I usually make a matrix like this [code] from Numeric import * A=zeros([3,3]) print str(A[0,1]) #access an element [/code] I would like to store a pair of values in each element, that is have a matrix where the (0,0) element is (2.3, 2.4), the (0,1) element is (5.6,6.7), etc. Is … | |
[code=python] import random class gameOfLife(object): def __init__(self, columns, rows, grid = []): self.grid = grid self.columns = columns self.rows = rows for i in range(0,self.rows): sub = ['-'] self.grid.append(sub) for sublist in grid: for i in range(0,self.columns-1): cell = ['-'] sublist.append(cell) def printGrid(self): for sublist in self.grid: print sublist def … | |
Hi All, I am developing a GUI in Boa Constructor. I am using a grid for displaying some data and want to change the names of the column and row headers in the grid. Please help me in achieving this. Regards, Dinil | |
[url]http://trac.edgewall.org/[/url] | |
Can I use python to read the contents of a text file on a server and dynamically update text on a web page(based on the text in that file)? This is something that I need to accomplish but I'm not sure if python is capable or if I should be … | |
hi every one. import os from reportlab.pdfgen import canvas from reportlab.lib.units import cm c = canvas.Canvas("/Users/venkatarampey/preview.pdf") c.drawString(8*cm, 28*cm,"HELLO PYTHON") c.showPage() c.save() FILE = open("/Users/venkatarampey/preview.pdf","r") The is the python script for previewing a pdf when run. Problem here is , i was able 2 generate a pdf on mentioned path but … | |
Hi All, I would like to create new rows dynamically. When a user clicks a button, a new row should be added in the grid. Please guide me as to how can I achieve this. Thanks, Dinil | |
Ok, Is there an easy way to do this: I want to take a string and convert it to a binary string with base of my choice and convert it back. So base 2 would be 1's and 0's, etc. example: [CODE=syntax] in_string = "testing" binary_string = string2binary(in_string, base = … | |
Hi all, This is a problem that has been holding me up for a while in Python. I frequently get issues relating to "global ___ is not defined" and cannot figure out what I'm doing wrong. Here is a coin-flip function I wrote: [code] def coinflip(): import random import time … | |
hi, im trying to learn python and this is giving me [ICODE]>>> x=input("Enter a value: ") if x % 2 ==0: print ("even") else: print ("odd")[/ICODE] then when i execute: Enter a number: then i enter a number but it does not print even or odd. why? | |
Hello, I want to total up a variable that changes every time a function is run. [code]import random def flip(): h,t = 0,1 cheads, ctails, = 0,0 cflips = random.choice((0,1)) if cflips == 0: cheads += 1 return 'h' else: ctails += 1 return 't' def repeat(f,n): for i in … | |
Hello, I am trying to write a program that flips a coin until it gets the sequence "heads tails heads" and then stops and says how many flips it took to get that sequence. This is what I have so far: [code]import random import time import string def coinflip(): heads … | |
How do I have the algorithm below to sort my list in opposite direction (right to left) instead of left to right. Also, how do I make it sort simultaneously or alternatively in both directions? Thanks. [code=python] def bubblesort(l): for passes in range(len(l)-1, 0, -1): for index in range(passes): if … | |
Is there anyway to compare lists or check to see how many of the objects in one list are the same as the other list? eg: L1 = [dog, cat, john, moo] L2 = [dog, cow, moo, stuff] there is two of the same "things" in it I'm trying to … | |
Hello, I'm trying to write a coin-flipping program. I can get the program to produce a random coin flip result (represented as either "h" or "t") but I want to add the individual result to an ever expanding string. For example, the first result would be "h" and the big … | |
hi everyone! I have two files, main.py and sprite_class.py. sprite_class.py is in a separate folder called lib. here's a quick diagram: ------------------------------------ /folder engine/ main.py /folder lib/ sprite_class.py ------------------------------------ ...sprite_class.py contains a class called Sprite: [CODE] # sprite class class Sprite(): def __init__( self, start_x, start_y, image_path ): self.x = … | |
| hi again i want to make something that captures images of my window and sove them into either a gif file or a video file, i thought about using win32s [code] win32gui.GetDesktopWindow() [/code] but i wasnt sure how to use this to save it to the file how could i … |
Hi every bod y I am new in programming and I like to start with pyqt but I can not find anything for learning in internet please help me how how can I write program with gt designer & when I make a form in qt how can it work(my … |
The End.