3,386 Posted Topics

Member Avatar for coderN
Member Avatar for TrustyTony
0
42
Member Avatar for Darion

You are trying to execute the interactive interpreter buffer content instead of the py file you saved yesterday in IDLE editor. Open your code from File->Open. Then push F5.

Member Avatar for Darion
0
371
Member Avatar for confusedman
Member Avatar for TrustyTony
0
314
Member Avatar for pjconrad

You could do something like: [CODE]try: cd = context.sql.sql_enroll_location(myid = id_cookie)[0] except IndexError: flocation = 'Not Selected' else: flocation = cd.company print(flocation) [/CODE]

Member Avatar for TrustyTony
0
1K
Member Avatar for DYP
Member Avatar for bigred50
Member Avatar for TrustyTony
0
166
Member Avatar for group256

You have bad variable names, all min, max and list are used in Python and unavailable for you when they are shadowed. Minimum you should do is to add _ in end of variable best is to use more specific free names. What is value of m when parameter list …

Member Avatar for group256
0
184
Member Avatar for kabilah

Are you using the [URL="http://en.wikipedia.org/wiki/Tower_of_Hanoi#Frame-Stewart_algorithm"][URL="http://www.google.fi/url?sa=t&source=web&cd=10&ved=0CHwQFjAJ&url=https%3A%2F%2Fwww2.bc.edu%2F~grigsbyj%2FRand_Final.pdf&rct=j&q=frame-stewart&ei=yyizTayPEsfG8QOq_fSVDA&usg=AFQjCNGqPUYHhtUg1odHsAFXXqddGTylcg&sig2=hMFNsWdYVUuYzyvDqvI5vg&cad=rja"]Frame-Stewart algorighm?[/URL][/URL]

Member Avatar for kabilah
0
1K
Member Avatar for Thisisnotanid

Snippsat: cleaned little your code, as loop was little strange: [CODE]import re, urllib def get_quote(symbol): base_url = 'http://finance.google.com/finance?q=' content = urllib.urlopen(base_url + symbol).read() find_q = re.search(r'\<span\sid="ref_\d+.*">(.+)<', content) return find_q.group(1) if find_q else 'no quote available for: %s' % symbol def print_quotes(companys): for company in companys: print '%s --> %s' % …

Member Avatar for Thisisnotanid
0
465
Member Avatar for TrustyTony

Noticed just that my positive rep power shooted to 13 or is there bug in the system? Maybe some announcement message of these kind of changes explaining the reason would be nice feedback? Also I noticed 'undo the vote for this post' option for post I upvoted and I have …

Member Avatar for TrustyTony
0
272
Member Avatar for rkcastillo
Member Avatar for sergent
Re: OS

This Tanenbaum book is what I studied in Helsinki University and also Linus Torvalds, it is kind of classic. i do not know the newer books though.[url]http://minix1.woodhull.com/osdi2/[/url]

Member Avatar for sergent
0
175
Member Avatar for Dan08

Find out formula for line going through mouse to where it points to and how to count distance between bullet and object (hint: math.hypot of delta)

Member Avatar for TrustyTony
0
3K
Member Avatar for Dude2714

[url]http://docs.python.org/py3k/tutorial/inputoutput.html#reading-and-writing-files[/url] [url]http://docs.python.org/py3k/library/shelve.html[/url]

Member Avatar for TrustyTony
0
140
Member Avatar for AutoPython

Fro me the vegaseat's code does not function well, this version works from command line (not IDLE): [CODE]# windows console only # C:\Windows\System32\msvcrt.dll contains C functions from msvcrt import getch mystring = c = '' while c.lower() != 'q': c = getch().decode("cp437") print(c) mystring += c print('Inputed string:', mystring) [/CODE] …

Member Avatar for TrustyTony
0
7K
Member Avatar for HiHe
Member Avatar for HiHe
0
282
Member Avatar for Thropian
Member Avatar for vegaseat
0
242
Member Avatar for charchar88

I do not know how much you learn from just looking other's code, better do it on your own. I can say it as I did it myself in Python language: [url]http://www.daniweb.com/software-development/python/code/299470[/url]. you could try to use my approach in c and see how it compares with the ready program …

Member Avatar for TrustyTony
0
374
Member Avatar for 650U

[url]http://www.daniweb.com/software-development/python/threads/359823[/url]

Member Avatar for e-papa
0
241
Member Avatar for e-papa

Or you can keep the original, sorted by points list and record the points where number of points change + 1 (or enumerate starting from 1) as position for that many points in dictionary. [CODE]import random COUNT = 20 MAXPOINTS = 12 points = [random.randint(1, MAXPOINTS) for count in range(COUNT)] …

Member Avatar for e-papa
0
221
Member Avatar for srw0801

That should do it if point1 is the point in numeric format, usually inputs are taken as string and are transformed as integer by int(). In your case however, the clicking points are already numbers, you maybe have to transform the points as mathematical points as generally computer screen coordinates …

Member Avatar for srw0801
0
441
Member Avatar for Learn_Pyhton

Also the count of { can be used with itertools.groupby to divide the file in parts. Be careful about what you call very big size file. At least the file size should be in hundreds of megabytes to call it huge these days.

Member Avatar for TrustyTony
0
154
Member Avatar for snivek

For me looks simple case of applying car to cdr of each sublist before calling the BFS. As it is one debuged group of code I would leave it alone as I understnd that the result would suffice to you without the weights.

Member Avatar for TrustyTony
0
1K
Member Avatar for kiranbkrishna

See my prophecy [URL="http://www.daniweb.com/software-development/python/threads/359823"]Home work challenge! ;)[/URL] And what it means to you for example: [URL="http://www.daniweb.com/software-development/python/code/list/114"]Thread code in pack style in tkinter[/URL] and the referred thread.

Member Avatar for TrustyTony
0
370
Member Avatar for jarograv
Member Avatar for TrustyTony
0
790
Member Avatar for josh48

Why if not [B]Case[/B] in lines 36..44? Your code has no reasonable function, for example continuously overwriting the Result variable.

Member Avatar for TrustyTony
0
124
Member Avatar for predator78

My understanding is that PyGame has not hidden main loop, but you must implement it explicitly in your program, I think you are free to put inside a class and hide it like tkinter for example does (and add some events of your own). Maybe this effort is similar: [url]http://gpwiki.org/index.php/Python:Pygame_OOP_Framework[/url] …

Member Avatar for predator78
0
162
Member Avatar for tvks

You are decoding a string that is not in reality using coding 'utf-8', I think it is using coding 'cp1252' like you said. Like my Python under Windows XP. [CODE]>>> a='hyvä' >>> a.decode('cp1252') u'hyv\xe4' >>> print a.decode('cp1252') hyvä >>> a.decode('utf-8') Traceback (most recent call last): File "<pyshell#2>", line 1, in …

Member Avatar for TrustyTony
0
179
Member Avatar for hughesadam_87
Member Avatar for jintujacob
Member Avatar for jintujacob
0
412
Member Avatar for koveras vehcna

Profile your code with cProfile to see what operations take most time. i would think that dictionary of list of sentences (or their index) containing given word would be helpfull.

Member Avatar for koveras vehcna
0
241
Member Avatar for Ineedhlp

num is not set to any value in your program. it is type of file of integer so you are supposed to open one file in your main code and close it at end of it like you do in one of the procedures.

Member Avatar for TrustyTony
0
67
Member Avatar for techie1991

Nice solution, reminded me about [URL="http://en.wikipedia.org/wiki/XOR_swap_algorithm"]Xor swap algorith[/URL]

Member Avatar for youwill
0
104
Member Avatar for Fo.katia
Member Avatar for vegaseat
0
468
Member Avatar for aaronmk2

I would use itertools.groupby with helper function is_fibonacci, before that the values must be sorted by the sme helper function as key.

Member Avatar for vegaseat
0
102
Member Avatar for South

Line 6: False value never used Line 7: Always False value not used Why you are using class instead of funtion?

Member Avatar for South
0
116
Member Avatar for ThePythonNoob
Member Avatar for Joeflims

What version have you installed from [url]http://python.org/download/[/url] and does your current path include the installation location? Do you have PYTHONPATH set?

Member Avatar for TrustyTony
0
773
Member Avatar for aaronmk2

[QUOTE=snippsat;1535455]Just a note collections Counter will always sort in descending count order. Here i also show [B]most_common()[/B],no we now that all word after 'it' has 1 as count. [CODE]from collections import Counter from string import punctuation text = """\ If you see a turn signal blinking on a car with …

Member Avatar for TrustyTony
0
3K
Member Avatar for Thropian

You can multiply with suitable complex number [url]http://effbot.org/zone/tkinter-complex-canvas.htm[/url]

Member Avatar for vegaseat
0
22K
Member Avatar for bertm81
Member Avatar for e-papa

word_jumble(word) == [iCODE]''.join(random.sample(word, len(word)))[/iCODE] Better to put all decision in one [iCODE]while True:[/iCODE] instead of deeper and deeper recursion to decision(). You can center text by center() method, it has optional parameter for fill character: [CODE]>>> 'Word Jumble Game'.center(71,'-') '----------------------------Word Jumble Game---------------------------' [/CODE] You can avoid escaping ' by \ …

Member Avatar for e-papa
0
672
Member Avatar for shawntheking

I could do it, if I needed to. Hope you enjoyed the challenge :icon_twisted: I am sure you reveal the solution soon.

Member Avatar for TrustyTony
-1
83
Member Avatar for dobleseis
Member Avatar for dobleseis
0
208
Member Avatar for TrustyTony

I found [URL="http://www.daniweb.com/software-development/cpp/threads/358674"]this assignment[/URL] on C++ forum as was browsing to see little where I am in my mostly C little C++ thrown in understanding of C++ and if I should try to increase my knowledge in that language. I could not believe my eyes! The OP is completely lost …

Member Avatar for TrustyTony
0
633
Member Avatar for TrustyTony

There is many more stupid things to do than to read words of one of the best if not the best: [URL="http://norvig.com/lispy2.html"](An ((Even Better) Lisp) Interpreter (in Python))[/URL]

Member Avatar for TrustyTony
1
1K
Member Avatar for diniboi

Again without code-tags! import math primes = [2, 3] def gen_primes(n): """return a list of factors up to sqrt(n)""" primes = [2,3] upper = int(round(math.ceil(math.sqrt(n)))) + 1 for k in xrange(3, upper): divisors = [p for p in primes if k % p == 0] if not divisors: primes.append(k) return …

Member Avatar for TrustyTony
0
224
Member Avatar for hous3aholik

This discussion inspired me to do one post to Python forum. Link back: [url]http://www.daniweb.com/software-development/python/threads/359213[/url]

Member Avatar for TrustyTony
0
2K
Member Avatar for parijat24

The End.