Search Results

Showing results 1 to 40 of 967
Search took 0.05 seconds.
Search: Posts Made By: woooee
Forum: Python 20 Minutes Ago
Replies: 8
Views: 228
Posted By woooee
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 1 Day Ago
Replies: 8
Views: 129
Posted By woooee
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 3 Days Ago
Replies: 8
Views: 228
Posted By woooee
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 3 Days Ago
Replies: 667
Views: 73,048
Posted By woooee
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 3 Days Ago
Replies: 5
Views: 121
Posted By woooee
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 4 Days Ago
Replies: 1
Views: 144
Posted By woooee
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 4 Days Ago
Replies: 7
Views: 208
Posted By woooee
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 4 Days Ago
Replies: 7
Views: 208
Posted By woooee
Double post, sorry.
Forum: Python 4 Days Ago
Replies: 2
Views: 150
Posted By woooee
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 4 Days Ago
Replies: 8
Views: 189
Posted By woooee
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 5 Days Ago
Replies: 3
Views: 140
Posted By woooee
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 7 Days Ago
Replies: 6
Views: 232
Posted By woooee
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 7 Days Ago
Replies: 4
Solved: Distinct Vlaues
Views: 156
Posted By woooee
This is very simple to do. print len(set([1,2,4,2,7]))
Forum: Python 10 Days Ago
Replies: 5
Views: 224
Posted By woooee
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 10 Days Ago
Replies: 4
Views: 219
Posted By woooee
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 10 Days Ago
Replies: 11
Views: 262
Posted By woooee
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 13 Days Ago
Replies: 6
Views: 261
Posted By woooee
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...
Forum: Python 13 Days Ago
Replies: 7
Views: 220
Posted By woooee
Always use absolute path+file names.filePath = "Dataset/parameter feature vectors"
for fname in os.listdir(filePath):
complete_name = os.path.join(filePath, fname)
data_str =...
Forum: Python 13 Days Ago
Replies: 2
Views: 137
Posted By woooee
Since you are testing 6 letters total, you want to use "len(w)-5" so you won't run out of letters. To set up an example using "aabbcc" as the simplest example, you only want the for loop to test the...
Forum: Python 13 Days Ago
Replies: 1
Views: 251
Posted By woooee
You want to use a class structure for this, so each player can be an instance of the same class, and divide the code into several small functions. if numatt not in [1,2,3]:
raise...
Forum: Python 15 Days Ago
Replies: 9
Solved: Be gentle
Views: 262
Posted By woooee
Alternatives would be: while (play_choice < 1) or (play_choice > 3):

while play_choice not in [1, 2, 3]:

# Also, you can use .lower instead of 2 compares
while play_again.lower() == 'y'':
Forum: Python 15 Days Ago
Replies: 2
Views: 189
Posted By woooee
You can set the encoding for the file
fp = codecs.open('test', encoding='utf-8', mode='w')

Or you can change the default encoding for the system
sys.setdefaultencoding('utf-8')

You may have...
Forum: Python 17 Days Ago
Replies: 16
Views: 366
Posted By woooee
You'll have to post your code as no one can tell what to do without code (Doh). If you are using a function, the function would return the length which would then be compared with the existing...
Forum: Python 18 Days Ago
Replies: 8
Solved: List help...
Views: 197
Posted By woooee
Using for() loops is easier. This is somewhat of a brute force method but works fine for smaller lists. L1=[[1,2,3],[4,5,6],[7,8,9],[10,11,12]]
L2=[1,2,3,4,11]
L3=[]

for number in L2:
...
Forum: Python 18 Days Ago
Replies: 16
Views: 366
Posted By woooee
This is a modified version of your program that prints what you expect. I am not sure if it is what you want or not. def tryit(start, end):
number = start
## number >= start
## number...
Forum: Python 21 Days Ago
Replies: 6
Code Snippet: Roman Numerals (Python)
Views: 3,107
Posted By woooee
Roman to integer. Note that it will take something like XXIXV and convert it. If someone already has a routine to check for valid input, please post it. And I'm afraid we've just eliminated one...
Forum: Python 21 Days Ago
Replies: 6
Views: 225
Posted By woooee
I'll save the pun for one of your posts. And it's now too late to change it. Oh well, we'll just have to let this thread wind down the list into obscurity.
Forum: Python 21 Days Ago
Replies: 3
Views: 214
Posted By woooee
You can pipe top to a file on Linux and then read the file.

Apparently you can use WMI for MS WIndows but I have not used it http://timgolden.me.uk/python/wmi_cookbook.html#running_processes
Forum: Python 21 Days Ago
Replies: 6
Views: 225
Posted By woooee
Please ass "Solved" to the thread title so no one else wastes their time on this.
Forum: Python 21 Days Ago
Replies: 12
Views: 417
Posted By woooee
Dictionaries are indexed via a hash and so make it easy to look up things, in this case the stock symbol, without going through the sub-strings in each list. Also, they provide a convenient way to...
Forum: Python 21 Days Ago
Replies: 6
Views: 225
Posted By woooee
Can you use a list instead of all of those variables? Otherwise, try the code below which tests each button individually instead of the confusing and, and, or, etc. in your code. Speaking of...
Forum: Python 21 Days Ago
Replies: 12
Views: 417
Posted By woooee
Doug Hellmann has excellent write ups. http://www.doughellmann.com/PyMOTW/

As far as books go, I like "Dive into Python" http://diveintopython.org/native_data_types/index.html#odbchelper.dict
Forum: Python 22 Days Ago
Replies: 1
Views: 186
Posted By woooee
This is a forum for the Python programming language. Your question should be asked at the swarmplayer site, or on a board for the distro that you are using.
Forum: Python 22 Days Ago
Replies: 12
Views: 417
Posted By woooee
This will get you started, but a dictionary would work much better for this. elif stChoice == 2:
for stock_list in portfolio:
print "symbol = %s for %s" % (stock_list[1], stock_list[0])...
Forum: Python 23 Days Ago
Replies: 2
Views: 206
Posted By woooee
longLength = 0
for i in range(startNum, stopNum + 1):
longLength = hailstone(i)
if i >= longLength:
longLength = i
...
Forum: Python 23 Days Ago
Replies: 7
Views: 365
Posted By woooee
This appears to work, but is still rough and just a proof of concept. It adds the unit to a dictionary as it's arrive time is reached, so that any finished units can be deleted from the dictionary...
Forum: Python 23 Days Ago
Replies: 13
Views: 621
Posted By woooee
You would have to step through the unicode and count the number of actual letters, and then add enough spaces to the string to make it the length you want. This appears to work, but you'll have to...
Forum: Python 23 Days Ago
Replies: 3
Views: 174
Posted By woooee
Also, write to the odd numbers file at the same time. Plus, do you want to test for zero or negative integers? def write_evens():

even_file = open("evens.txt", "w")
odds_file =...
Forum: Python 24 Days Ago
Replies: 7
Views: 365
Posted By woooee
It appears that the problem is here
while sum(waitToExe) != 0: #while the sum of waiting's execution duration is NOT zero...

You subtract from waitToExe, but not until it reaches zero. It...
Forum: Python 24 Days Ago
Replies: 18
Views: 537
Posted By woooee
You want to keep all of the sqlite stuff in Database.py and call the add, change, delete functions from the WX program. An example using addition. import sqlite3
##import addnew

class DBClass:
...
Showing results 1 to 40 of 967

 


About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC