3,386 Posted Topics
Re: In my computer it takes 16 iterations from 0.9 to reach floating point limit of accuracy, if you mean that: [CODE]1 0.99 2 0.999 3 0.9999 4 0.99999 5 0.9999990000000001 6 0.9999999 7 0.9999999900000001 8 0.999999999 9 0.9999999999 10 0.99999999999 11 0.999999999999 12 0.9999999999999001 13 0.99999999999999 14 0.999999999999999 15 0.9999999999999999 … | |
Re: On the contrary, we want your teacher recognize your code to your work and appreciate it, but we can give hints and stuff. I think maybe simple XOR encryption would be enough for you, as you probably do not want to use [URL="http://www.cityinthesky.co.uk/opensource/dcpcrypt"]third party crypto modules[/URL]. | |
The [URL="http://pypy.org/"]PyPy [/URL]development team has announced the release of version 1.6 of its "very compliant" Python interpreter with integrated tracing just-in-time (JIT) compiler. According to the developers, the latest update fully implements Python 2.7.1 and brings speed and stability improvements. Code-named "kickass panda", PyPy 1.6 is said to be between … | |
Re: Here seems to be info how to interface Cards in Java: [url]http://www.oracle.com/technetwork/java/javacard/overview/index.html[/url] | |
Re: If you post your honest own effort we help you out. Notice that even though experienced coder could do this code quickly, you should basically add code line be line making sure you get intended result from your additions by debug prints (or debug decorator). Quality is important as is … | |
Re: Nobody seems to be in hurry. Normally you continue after password match and otherwise exit. Your code is joke as you would have error latest at line 4. I do not understand also how you would check passwords from everybody and accept them to all users. | |
Re: sort is in place function, sometimes in other languages called procedure, which does not return value, but directly orders the list. So you must print list1 next line after sort or you should use sorted function. | |
Re: Couldn't be simpler just decide between Python2 and Python3 (or install both, preffered one last, as it associates the .py files each times to installed Python version): [url]http://python.org/download/[/url] | |
Re: You must put try around the fileinput that is in try to line "5.5" and indent the print line and 7 to same level as try: (current print indention). | |
Re: You can compare to this: [url]http://www.daniweb.com/software-development/computer-science/threads/324685[/url] [QUOTE] O(2^n) – exponential time, may God have mercy on our souls, because this thing is fast growing. The algorithm growth will double for each new element in the data input! For n=1 we will have 2 operations, for n=2 4 operations, for n=3 … | |
Re: [QUOTE=dave8;1650459]This code only works for space separated files. It will not work for fixed width positional files.[/QUOTE] The input given is not positional, but variable width. You can see, if you look given input by clicking reply for the original post (as it has no code tags). Fixed width input … | |
Re: Don't use the libraries, so can not test, but something similar to this, maybe: [CODE]import pythoncom, pyHook def stroke(event): if event.WindowName != stroke.current_window: print event.WindowName stroke.current_window = event.WindowName print event.Key stroke.current_window = None ph = pyHook.HookManager() ph.KeyDown = stroke ph.HookKeyboard() pythoncom.PumpMessages()[/CODE] | |
Re: for loop with user input count is not as user friendly as input until special value, say 0. Using eval on direct user input is considered bad idea as with suitable input user can do any OS command. | |
Re: It is against most nature to do very fixed function programs, when they can be general but in the case of 3 letters (be they numbers or so what) you could do comparision of a and b against others until success. pseudocode: [CODE] read characters in as a,b,c if a … | |
Re: other way is to remove one by one the letter from the copy of the usable letters, succeed if all were found, otherwise fail at first letter not found. Maybe you want to check first that length of the target word is shorter than usable letter string. | |
Re: Check Tkinter.Tcl command. | |
Re: Probably problem with garbage collected image, if you do not do OO, you must have clear loop of main action in main code/single function. (The way you chain functions by calling show at end of get_image is uggly, better to have only one function) I found it easier to change … | |
I did some transformation of overcomplicated Rosetta code version | |
Re: And how you tried to do that? Show your effort. | |
Re: May the DaniWeb (and Vegaseat) be with you! [url]http://www.daniweb.com/software-development/python/threads/191210/948470#post948470[/url] | |
Re: Do you mean AES/Rijndael? There is also this component [url]http://code.google.com/p/delphidec/downloads/list[/url] It has example.txt file on how to use it. Maybe you find it easier to use, haven't used it myself, just googled it. | |
Roman numbers is a standard programming exercise, to give it a small twist, we input roman numeral, turn it to value and prepare minimal version of it using the substraction rule. Correctness of the input is not checked so Garbage in - Garbage out. | |
While looking stuff about idlelib, I came to [URL="http://stackoverflow.com/questions/3431498/what-code-can-i-use-to-check-if-python-is-running-in-idle"]this thread in stackoverflow[/URL], so I posted own solution. I post it also here, as maybe somebody needs it (as for example \b looks ugly in IDLE) | |
Re: Probably most known is [url]http://garage.cse.msu.edu/software/lil-gp/[/url] | |
Re: c: I do not have dishes in my computer but disc I have however. Also why not a) explanation: What if you deleted 50 pages by mistake, does auto save help? | |
Re: Is the Python version same and both 32 or both 64 bits version? Could you post the profiler outputs? | |
Re: What are you trying to do with 'the' at the end? | |
Re: You need to actually save the widget only if you refer to it later to change it, also some case it is necessary to store the widget somewhere so garbage collector does not collect it as rubbish. If you do grid together with creation, you should not assign the None … | |
Re: What type self has? Maybe you should use self.grid? | |
Re: I do not know about your Personal Digital Assistant to answer this question. Or you mean Pennsylvania Dentist Association:-/ | |
Re: split, like I mailed you in first post but now from ',', and convert to int or float each value. | |
Re: You are calling the __init__ of inherited class in beginning of child __init__ , aren't you? Could you post restricted example with only the problem behaviour? | |
Re: Hi, I think the style of programming for reading that Python philosophy encourages agrees with interests of your business logic. I do not know exactly what are your requirements, source to source translation you have ready, otherwise you could have tried to adapt pypy JIT environment for your application. Usually … | |
Re: I do not know what problem you have, the conversion with `2to3.py` script did not succeed? Next time push (CODE) before pasting your code and put your imports (only once) at beginning of the code (moved those) #! /usr/bin/python import socket import struct import sys import os import string import … | |
Picked up from old thread but currently applicable (the IBAN number became more widely required actually this year in Finland). The style was quite alien for modern Python coders, so I massaged the code to my own liking. I removed many temporary variables, as for my opinion they did not … | |
Re: I think the previous poster mistook question dealing with Fibonacci numbers. Reference in wikipedia: [url]http://en.wikipedia.org/wiki/Fibonacci_heap[/url] | |
Re: I did it slightly differently but same, without re (you loose the special meaning of [] though, so I added -e flag for exact replacement for []): [CODE]import glob import sys # use -e flag to replace [] pattern = ''.join(c if c not in '[]' else '[' + c … | |
Re: You have zero in your input at second column, not first one. Input has float but you have output with integer string value, is output value integral You can split task in two, just read in the float numbers with with open ...as. And process with strip and split methods, … | |
Re: Easiest way could be to use Gribouillis Cmd class: [url]http://www.daniweb.com/software-development/python/code/257449[/url] For hostname, I think you can find it through environment variable: [url]http://www.comptechdoc.org/os/linux/usersguide/linux_ugenvironment.html[/url] [CODE]import os print(os.environ.get('HOSTNAME'))[/CODE] | |
By coding algorithm and using some liberal prints with small set of data, you can learn to understand the basic algorithms better than just reading about them. Here simple selection sort. | |
Re: For second one I point you to this other current thread, even there is much better ones, as I want you to have practice to doing it yourself: [url]http://www.daniweb.com/software-development/python/threads/381869/1644529#post1644529[/url] As I have researched anagrams as training project when learning Python myself, I want to wish you luck! | |
Re: You have long experience in programming, and it shows. Code optimizes checking brick hits from only one wall, however I feel that using attribute containing all bricks would simplify much the program. You could even calculate crossing point mathematically, direction is changed only at walls and pad, which can be … | |
How about doing some effort instead of immediately voicing your desperation to Daniweb for 1001st tictactoe problem? Here is some ideas for those young spirits (I did not say newbies ;) ) 1. What is this search box here over in right hand corner? 2. What a heck is this … | |
Re: Maybe because you set m = len(numberlist) and indexes of numberlist goes until len(numberlist) - 1 (and start from zero). With code tags your code would be much nicer to read. | |
Re: Isn't that done normally by SPACE by the window manager? | |
Re: It never has the first time through as it reads first and if the file does not exist it stops with error message. | |
Re: How about defining dictionary of dictionaries and using the desired names as lookup from that table. Actually the variables of Python are defined that way, one table for globals and other for locals, if I have not understood wrong. See for example documentation of eval function. |
The End.