Forum: Python 1 Day Ago |
| Replies: 2 Views: 126 A Google coughed up pyq, a download for quotes from Yahoo, and there are sure to be others. This question would probably get more answers on a trading forum, as this one is for coding only. |
Forum: Python 1 Day Ago |
| Replies: 4 Views: 158 Python does not have static variables, but does have global variables, which those are not. They are class objects and would be called using
Atom.cartesian
both inside and outside the class. In... |
Forum: Python 2 Days Ago |
| Replies: 4 Views: 158 You have both class instances and class objects. The variables
cartesian = dict()
bondList = list()
atomName = str()
atomicNum = int()
would point to the same variable (block... |
Forum: Geeks' Lounge 2 Days Ago |
| Replies: 672 Views: 75,063 It's Christmas madness already. In 1999, the United States Postal Service issued a Slinky postage stamp (the spring toy that slinks down the stairs). In 2001, House Bill No.1893 of the 2001 Session... |
Forum: Python 2 Days Ago |
| Replies: 6 Views: 213 That's called string formatting http://www.python.org/doc/2.5.2/lib/typesseq-strings.html (assuming you are using Python 2.5). A simple example: year = 1
pop = 12345
for x in range(2):
print... |
Forum: Python 2 Days Ago |
| Replies: 1 Views: 119 For starters, you can use one function to do the output. Also, store the output strings in a dictionary. You can then use a for loop to go through the
if intFCITC_list[0-->10]<0:
and send the... |
Forum: Python 6 Days Ago |
| Replies: 15 Views: 444 Because every row is the same block of memory = fieldb
for i in range(columns):
fieldb.append('.')
for i in range(rows):
fielda.append(fieldb)
#
# These will all be the same because... |
Forum: Python 6 Days Ago |
| Replies: 6 Views: 257 You really should consider using a class for this. Otherwise it gets real convoluted real fast. If you want some assistance, post back. |
Forum: Python 6 Days Ago |
| Replies: 6 Views: 237 You should use this with a try/except (within is while) since anyone would enter more or fewer characters at some time. |
Forum: Python 7 Days Ago |
| Replies: 3 Views: 238 I would assign a unique number to each character that makes up a maze. Then you can find S(tart) and proceed in whatever direction there is an space, keeping track of the path taken so you try ... |
Forum: Python 8 Days Ago |
| Replies: 16 Views: 348 Agreed. You should do your own research from here. Especially since you are just going to forget most of this anyway. Herb Schildt was the consensus guru when this was commonly done, so if you can... |
Forum: Python 9 Days Ago |
| Replies: 16 Views: 348 If you wanted to draw a box on the screen and display some sort of message, you would have to access the memory on the video card. Before toolkits like Tkinter that is the way it was done. In... |
Forum: Python 9 Days Ago |
| Replies: 2 Views: 168 Use the min function to find the smallest number. Is it just me, or is there one person with 100 different ID's who posts every homework problem here, saying they don't have a clue==don't even try. ... |
Forum: Python 11 Days Ago |
| Replies: 1 Views: 151 88282440 PKD0
Test that the first byte is a digit, split on the space if true, and test that the second element starts with a "P", then print everything that starts with a "D" that follows if I... |
Forum: Python 12 Days Ago |
| Replies: 7 Views: 204 Try this and then go to the page from the earlier link which explains why you returned a tuple. def junk(f):
d1 = {}
d2 = {}
for line in f:
columns = line.split(":")
... |
Forum: Python 12 Days Ago |
| Replies: 1 Views: 305 You would probably have to use a large grid with squares, like a large tic-tac-toe board, with a unique number for each square . Also, if you store what the square is, a wall or open space, then you... |
Forum: Python 12 Days Ago |
| Replies: 7 Views: 204 First you are not returning a dictionary. I've added a print statement to show that. Also, take a look at "returns" and "arguments" here http://www.penzilla.net/tutorials/python/functions/ for the... |
Forum: Python 12 Days Ago |
| Replies: 2 Views: 230 It is generally done with a list. def test_input(input_str):
accept_list = []
for x in range(0, 10):
accept_list.append(str(x))
accept_list.append("d")
accept_list.append("r")... |
Forum: Python 12 Days Ago |
| Replies: 1 Views: 128 That is usually a directory problem, i.e. it can't find something because it is not in the current directory. For this line, give it the absolute path name
tune =... |
Forum: Python 13 Days Ago |
| Replies: 5 Views: 312 It should be simple with Python's gstreamer interface. http://pygstdocs.berlios.de/ |
Forum: Python 13 Days Ago |
| Replies: 16 Views: 313 Not enough info for anyone to help (could be an indentation error, or could be in the calcs). First add some print statements for the individual calcs to isolate the error, and post the specific... |
Forum: Python 13 Days Ago |
| Replies: 7 Views: 199 Do you have to use something like queue_draw() to update the widget? The pygtk.org site has been down for 2 days now, so can't look it up, but try it and see.
Just write a simple program using... |
Forum: Python 14 Days Ago |
| Replies: 8 Views: 226 finderGuess = finderGuess - ((((finderGuess*((1+finderGuess)^numberMonths))/(((1+finderGuess)^numberMonths)-1))-
(monthlyPayment/loanAmount))/(((((1+finderGuess)^numberMonths)-1)
... |
Forum: Python 14 Days Ago |
| Replies: 9 Views: 508 There are several online pages to do that.
http://primes.utm.edu/curios/includes/primetest.php
is one found on this very good page
http://primes.utm.edu/
Your program works correctly, at least... |
Forum: Python 15 Days Ago |
| Replies: 9 Views: 239 All data is binary. That's the way the computer does it. I am assuming that you mean bytes that are not text. If you look at an ASCII table like this one http://www.asciitable.com/ it becomes... |
Forum: Python 17 Days Ago |
| Replies: 9 Views: 508 Wouldn't this lead to an infinite loop. def Prime(x,y):
n=2
if x == 1:
Prime(x+1,y)
elif x == 2:
print (2)
Prime(x+1,y)
elif x <= 0:
print ("Number must... |
Forum: Geeks' Lounge 17 Days Ago |
| Replies: 672 Views: 75,063 Via CNet
On average, cell phone users in the United States buy new gear every 18 months. In Japan, it's about 9 months. In Europe, cell phone users get new phones every year. |
Forum: Python 17 Days Ago |
| Replies: 5 Views: 249 Take on something that is easier first. If you have no idea at all on how to start, then there is little that anyone can do. |
Forum: Python 19 Days Ago |
| Replies: 1 Views: 198 Start with something like this (Not Tested).energyFile = open("EnergySources.csv","r")
state_dict = {}
for line in energyFile:
line = line.strip()
fields = line.split(",")
state =... |
Forum: Python 19 Days Ago |
| Replies: 7 Views: 264 Since you are using python 2.x, this won't work. Test this code by entering "R1" and "1/01/2000" and see what happens ( and look at "Is there an easy way to do user input in python?" here... |
Forum: Python 19 Days Ago |
| Replies: 7 Views: 264 |
Forum: Python 19 Days Ago |
| Replies: 2 Views: 220 Some corrections to get you started, provided the indentation is correct.def encrypted_message():
## "message" has not been defined in this function
char = message
encrypted_message =... |
Forum: Python 19 Days Ago |
| Replies: 8 Views: 224 You want to use "readlines()",as readline reads one line at a time, where readlines() reads all data. Also, a print statement is added for clarity.records = open(grades.txt,'r').readlines()
table =... |
Forum: Python 19 Days Ago |
| Replies: 3 Views: 206 And it's not tough to do. import Tkinter
root = Tkinter.Tk()
root.title('Canvas')
canvas = Tkinter.Canvas(root, width=450, height=450)
canvas.create_oval(100,50,150,100, fill='gray90')
x =... |
Forum: Python 22 Days Ago |
| Replies: 6 Views: 307 If you don't know how to open and read a text file, then look at one of the online tutorials like here http://effbot.org/zone/readline-performance.htm Then get the input from the user, etc. ... |
Forum: Python 22 Days Ago |
| Replies: 4 Views: 207 This is very simple to do. print len(set([1,2,4,2,7])) |
Forum: Python 24 Days Ago |
| Replies: 5 Views: 313 Google came up with this site which has a link to download source code. I hope you didn't pay $99.95 for the book! http://www.jbpub.com/catalog/9780763746025/ |
Forum: Python 24 Days Ago |
| Replies: 4 Views: 263 First, you have to decide which GUI toolkit you want to use. Here's an example Google found using Tkinter http://code.activestate.com/recipes/124894/ |
Forum: Python 24 Days Ago |
| Replies: 11 Views: 395 You can modify it on startup by adding PYTHONPATH to your ~/.bash.rc file, or create one if you don't have it.
export PYTHONPATH=$PYTHONPATH:/path/to/add:/second/path |
Forum: Python 27 Days Ago |
| Replies: 6 Views: 299 When validating, you want to include, not exclude. So you want a list of data that is acceptable, and the input has to be in the list. That way, when another unit or type of data is introduced it... |