15,185 Topics
| |
So I am done with the code below, I will run it like this "python hw3.py < code.txt" I think I have a problem with the indentation or something. the code.txt has a mixed up text in it that is offset using a caesar cipher but it has to be … | |
def random(fileName) setup = open(fileName, "r" ) z = setup.readline() waiting = stack() for line in setup: customerNum, arrivalTime, serviceTime = line.split() plane = Customer(customerNum, arrivalTime, serviceTime) push(waiting, plane) setup.close() print "The data file specifies a", z, "-server simulation." print "There are", len(waiting) , "arrival events in the data file." … | |
Hi guys, Having a bit of a problem with reading and writing to a file. I have a file that has a lot of symbolic stuff I want to remove. And get a new kinda clean file with just the numbers and names. And it finds the line where it … | |
I am creating a bar graph essentially **just by only using the graphics module**. I am stuck with it. Below is my code that I have done which creates a perfect square. (10 x 10) so for every one bar I was it to decrease by 10. def drawRectanglePatch(win, x, … | |
How can i locate a file or a folder using python like some when we right click in downloaded files using firefox and open containing folder,and it opens the explorer and pre selects the file downloaded. how can this functionaly be implemented using python standard library ? however this code … | |
Hi, Im new to programming and to Python. Im making a program to get weather information from online, parse it the way I want to, then have Festival read it aloud to me. I got the weather info and parsing done exactly how I want but am getting an error … | |
I am trying to make this pattern in python but stuck, any help please? Ashley http://images.colourbox.com/thumb_COLOURBOX3492089.jpg | |
` This is the code of Tic Tac Toe from Python the absolute beginner. How could I edit the global constants so the user could pick the pieces or should I just remove them all together? # global constants X = "X" O = "O" EMPTY = " " TIE … | |
I'm having a little problem. The challenge is this: "Modify the program so that different shapes are drawn at each angle rather than a small filled circle". So I'm trying to change the middle shape when the second hand hits 12, 3, 6, and 9. I've got some code, but … | |
Dear members, i have a question. I created my software (with windows made with wxpython) and with py2exe I embed the icon into the exe. Since I would like to add the same icon file (or any other image) also as decoration in the window but I don't want to … | |
I am trying to add collision detection to this simple game, but I am a little lost on where to begin. I know I need to use rects to do this but I am struggling to find out what I need to code to make this work. Any pseudocode or … | |
Today i was reading someone written code and trying to understand it, but I have encountered so many times that programmers override builtin methods or set new properties , the code below is from a tutorial i came accross , I hope some one can help me out how code … | |
Let's say you have a whole bunch of nicely named lists and want to save them all and their names in a pickle file. One solution can be to store these lists and their names in a Bag container class and pickle the bag instance object. Now you can use … | |
I have a video program that use gstreamer and wxwidgets. Before Ubuntu 9.10, the program works fine. But since I upgraded to 9.10 (or 10.04), it keeps getting crashes when trying to view video. The error is usually Fatal X11 IO error. I googled and found that GTK+ implementation is … | |
Hi guys...I'm new to python so I've no idea what I'm doing but I need to write a function that 1) asks the user how many strings they would like to input. 2)Stores the strings in a list 3) sorts the list 4) Displays the sorted list 5) Displays the … | |
I have made a package with the name MaPySan that has `__init__.py` file and other files namely, DockedGUI.py and poseManager.py and inside `__init__.py` i have, `import poseManager` which is my app that I want to run so how should I have it run from script editor that I do not … | |
a program that asks user to enter number of people their birth year date and month and sorts it i got the algorithm figured out its just the code thats not hitting me! | |
Which is the most popular editor on these forums, please? Especially so, an editor that takes Python to the maximum of what it is capable of achieving. I'm hoping that I won't need such-and-such an editor to do this, and such-and-such an editor to do that... An all-in-one if possible. … | |
Question Enter a code that will test if player 'A' for team A or 'B' for team B was entered Call the procedure display_player( , ) with the relevant variables Enter the code that request the user to enter the positon My failes answer is: def diplay_player(team, position): team = … | |
Hello. I have a python script to post news a website but i want to know how i can pass variables from php to the python script and run the script from php. Python script: (I didn't create this, was done by a friend) [CODE] import urllib2, urllib USER = … | |
Hi:) Would any of you know how to solve one of the following problems? I dont't care which one!! 1. Write a program that reads in student marks until –1 is entered then display the highest mark, the lowest mark, and the class median. 2. Setting up matches for a … | |
![image_(2)](/attachments/small/4/image_(2).jpeg "align-left") ![image_(2)](/attachments/large/4/image_(2).jpeg "image_(2)") Hi There, I'm having a problem looping text I have attached an image of what I want. Thanks in advance, Ashley def drawPatch(win, x, y, colour): for i in range(5): for j in range(5): topLeftX = x + i * 20 topLeftY = y + j … | |
Hi there, I am trying to repeat my triangle on 100px by 100px; Any help is much appreciated. Many thanks, Ashley def drawTrianglePatch(win, x, y, colour): for i in range(5): for j in range(5): if (i + j) % 2 == 0: triangle = i * 20 triangle = y … | |
When trying to load csv file data into Scribus it only takes the data of the last row. I'm using ScribusGenerator.py by Ekkehard Will and my best guess is that the cause of the problem is somewhere in this part of the code: def replaceVariablesWithCsvData(self, headerRow, row, lines): # lines … | |
what are site directories in python ? are these some special folders ? | |
Hi all I have been asked to calculate days in a week. I know there is not 24 hours but 23 hours 56 minutes in a siderial day. How do I express that fraction in interactive mode. For example: print 60*23/56/60*7 or something to that effect. Anyone? Glenn. | |
I was promted with this problem, and cant even seem to figure out where to start??? Any help appreciated. Thanks. Write an algorithm for each of the following python operations and test you algorithm by writing a it up in a suitable function. You are not allowed to use the … | |
Hey everyone. I really need help with a question in Python. I have been trying for several days to figure this out. Any help will be much appreciated! Here is the question: Body Mass Index (BMI) is a good indicator of boy fatness for most people. The formula for BMI … | |
Hi :) I'm writing a simple program where I need to create multiple lists when i start (from a file) and write them to the file when I quit. I've googled and found that the best way is to put all the lists into a tuple and then write that … | |
This python 2.7 snippet adds a thin layer of sugar on the itertools module's api, allowing many of its functions to be used as decorators and adding some new functions. Enjoy ! |
The End.