3,386 Posted Topics
Re: Any help from [url]http://www.toves.org/books/data/ch06-hash/index.html?[/url] | |
Re: 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. | |
Re: Fix your indention. Return from __init__ does not make sense. | |
Re: 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] | |
| |
Re: [url]http://www.math.bas.bg/bantchev/place/rpn/rpn.ada.html[/url] | |
Re: 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 … | |
Re: 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] | |
Re: 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' % … | |
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 … | |
Re: [url]http://www.robotstxt.org/orig.html[/url] | |
Re: 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] | |
Re: 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) | |
Re: [url]http://docs.python.org/py3k/tutorial/inputoutput.html#reading-and-writing-files[/url] [url]http://docs.python.org/py3k/library/shelve.html[/url] | |
Re: 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] … | |
Re: So for Python2.7 you need Circle(object), which is clearer anyway. | |
Re: You better post what you have tried. Remember code-tags. | |
Re: 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 … | |
Re: [url]http://www.daniweb.com/software-development/python/threads/359823[/url] | |
Re: 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)] … | |
Re: 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 … | |
Re: 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. | |
Re: 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. | |
Re: 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. | |
Re: why you don't use list or tuple? | |
I wrote this as reaction for Pascal newbie's question in Pascal Delphi forum. | |
Re: Why if not [B]Case[/B] in lines 36..44? Your code has no reasonable function, for example continuously overwriting the Result variable. | |
Re: 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] … | |
![]() | Re: 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 … |
| |
Re: Your indention is off, for other things I can not help as you do not explain your problem. | |
Re: 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. | |
Re: 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. | |
Re: Nice solution, reminded me about [URL="http://en.wikipedia.org/wiki/XOR_swap_algorithm"]Xor swap algorith[/URL] | |
Re: Maybe I am getting old, but I do not see any circles nor any Python indention (with code tags). | |
Re: I would use itertools.groupby with helper function is_fibonacci, before that the values must be sorted by the sme helper function as key. | |
Re: Line 6: False value never used Line 7: Always False value not used Why you are using class instead of funtion? | |
Re: Especially line 41 does not make any sense. | |
Re: 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? | |
Re: [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 … | |
Re: You can multiply with suitable complex number [url]http://effbot.org/zone/tkinter-complex-canvas.htm[/url] | |
Re: what kind of error messages are you getting from elementtree? | |
Re: 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 \ … | |
Re: I could do it, if I needed to. Hope you enjoyed the challenge :icon_twisted: I am sure you reveal the solution soon. | |
Re: We try to help the people who post they code and what they have done to solve problem. | |
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 … | |
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] | |
Re: 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 … | |
Re: This discussion inspired me to do one post to Python forum. Link back: [url]http://www.daniweb.com/software-development/python/threads/359213[/url] | |
Re: itertools.combinations seems to do the job for you. |
The End.