15,175 Topics
| |
There seems to be many ways to create a dictionary, which one do you prefer? | |
I am going to create graphics interface to intermediate code generated by the gcc. so the output from gcc is like ;; Function main (main, funcdef_no=1, decl_uid=2162, cgraph_uid=1) main () { int i; int c[10]; int b; int a; int D.2177; <bb 2>: a = 1; b = 20; if … | |
| I have been working on a Python coded priority email inbox, with the ultimate aim of using a machine learning algorithm to label (or classify) a selection of emails as either important or un-important. I will begin with some background information and then move into my question. I have so … |
Hey this bit of code is giving a lot of trouble. I am new to python and have no idea why I am getting an error like this : Traceback (most recent call last): File "D:/Python27/saved/digital_filter.py", line 83, in <module> app=Application(root) File "D:/Python27/saved/digital_filter.py", line 23, in __init__ self.create_widgets() File "D:/Python27/saved/digital_filter.py", … | |
Hi. I'm currently working on my bachelor's thesis in which i'm hoping to assess whether a (simplified) programming exam generates a "better" result if taken in an adjusted computerized environment compared to taking it with only the use of pencil and paper. I have built a web based platform, with … | |
I have over 10 text files, each file has exactly 2671 floats e.g. 1.232124234 #line 1 2.324234323 #line 2 . . 1.324234234 # line 2671 I would like to the add together the floats on each line with the float on the corresponding line for each of the 10 files, … | |
Hi guys, I got this from my teacher and im really confused. could anyone point me in the right direction? Thanks > What does it do? > > This time I'm looking for an overall summary, in one sentence, with the word "by" in the middle: > "This function ..........., … | |
so i'm making a project for a buddy that's going to (eventually) ask a word, then it's definition, and I need 50 entry boxes on the screen, but there must be a simpler way to grid all of them (I'd like to use a sort of for loop instead of … | |
Notice that if you negate a boolean value with `not` in comparison with other boolean value or similar, you should put it inside a pair of parenthesis, otherwise you get syntax error: >>> 0 == not 1 SyntaxError: invalid syntax >>> 0 == (not 1) True >>> | |
In [this thread](http://www.daniweb.com/community-center/geeks-lounge/threads/436142/which-language-is-best-suited) in the Geeks Lounge it was wisely recommended that I download an add-on for Python called Numpy. However, Numpy isn't presently available for Python 3.3. What should I do, please? How important is Numpy? Also, what would be the implications for not having wxpython available to Python … | |
How do you get an imported function to find a function in the main program? This runs fine if I put the generate_random function in with the main, but if it is in an imported function it can't find the printa function in the main. It comes up with the … | |
Hi, I am unable to run the code given in the following link https://github.com/hamilton/LocalitySensitiveHashing properly. Can anyone help me on the instructions, as in where and how to provide the data. I am facing problem in the following step : this_lsh.bin_data(data) as given in the README. I am unable to … | |
I tried to create those 6 radiobuttons(bh1,bh2,bh3,bh4,bh5,bh6) using a for and placing them in a dictionary but I get the following error whenever they should be displayed! I have attached a folder with the images. Any help please is highly appreciated! Thank you Exception in Tkinter callback Traceback (most recent … | |
Just polling for users who are familiar with Django. Deployment? Development? Maintenance? Doesn't matter! Just trying to get a head count, maybe spawn some topics, make some friends, or whatever. Django is a pretty fantasitic project. It is extensive and documented extremely well (almost too well; reminds me of the … | |
inventory = {'gold' : 500, 'pouch' : ['flint', 'twine', 'gemstone'], 'backpack' : ['xylophone','dagger', 'bedroll','bread loaf']} how do i delete the item 'dagger' only from the 'backpack' | |
My company recently hosted a programming competition for schools across the country. One team made it to the finals using the Python client, one of the four default clients provided (I wrote it). Most of the other teams were using Java or C#. Guess which team won? http://www.windward.net/codewar/2013_01/finals.html * *This … | |
I have this code so far #Add two digits def add(a,b): return a+b #Subtract two digits def sub(a,b): return a-b #Multiply two digits def mul(a,b): return a*b #Divide two digits def div(a,b): return a/b #returns an integer that the user enters def getCommand(): cmd = input("Choose: ") return cmd #Execute … | |
I have 2 text files: *cities.txt* San Francisco Los Angeles Seattle Dallas *master.txt* Atlanta is chill and laid-back. I love **Los Angeles**. Coming to **Dallas** was the right choice. New York is so busy! **San Francisco** is fun. Moving to Boston soon! Go to **Seattle** in the summer. *output.txt* <main><beg>I … | |
Hi ALL, I want to analyze my data by a python script. The data are in multiple file and they are kept in different directories. Moreover, the name of the files in those directories are same but have different extension. I want to get my output just by providing a … | |
Hello Daniweb, I'm learning Python at the moment, and I'm starting by looking at automating some of my server tasks, namely things like backups, virus scans and checking for IP changes (being on a dynamic IP, automating this task will be very helpful). I've started by creating some code which … | |
# Purpose: Tax input amount # #----------------------------------------------------------------------- # VARIABLE DEFINITIONS salesAmount= 0.0 salesTax=0.0 total=0.0 #----------------------------------------------------------------------- # CONSTANT DEFINITIONS #----------------------------------------------------------------------- # FUNCTION DEFINITIONS #----------------------------------------------------------------------- # PROGRAM'S MAIN LOGIC salesAmount = float (raw_input("Enter the sales amount:")) salesTax = float(salesAmount*0.08) total = salesAmount + salesTax print "The sales amount is $", salesAmount print … | |
You may want to call Python's list the answer to other computer languages' arrays. Here we take a look at the things you can do with lists, create an empty list, list the attributes and methods, load, append, count, insert, join, pop, remove, remove duplicate items, reverse, search, sort, establish … | |
I have a table with product codes, the first two chars of the product code is the product group. using the product group I'd like to test the content of certain data. Would this be proper coding or is there a better way ? if prodcust_code[:2] == "AB" do: ABsubroutine … | |
Really quick question, if I want to return the data that is returned by snesVar in videoGame as a string on every line, what is the correct code to use? def videoGame(): count = 0 snesVar = [] for data in os.listdir('/SNES/SNES Roms'): if data.endswith('.src') or data.endswith('.srm'): snesVar.append(data) return snesVar … | |
Hi all, I am trying to rewrite the following code, to avoid having to write 60 individual loops,I would really appreciate your help with this. # Long Version - not ideal num = 60 n = [open('n%i.txt' % i, "w") for i in range (num)] for a2s1, a2s0, a1s1, a1s0 … | |
![circuit](/attachments/small/2/circuit.jpg "align-right") Here is a version in Python of program from classic Lisp book (see http://www.daniweb.com/software-development/legacy-languages/code/446235/simple-scheme-functions-for-finding-impedance-for-norvigs-implementation for the details) for calculating impedance of a circuit. (Example circuit with 1MOhm like in the book's code not like in diagram) | |
![Lisp001](/attachments/small/2/Lisp001.jpg "align-left") ![Lisp002](/attachments/small/2/Lisp002.jpg "align-right") I did translation to minimal Scheme implementation of Norvig written in Python (http://www.daniweb.com/software-development/python/threads/359370/norvig-an-even-better-lisp-interpreter-in-python) of the impedance code defined in classic book **Lisp by *Patric Henry Winston* and *Berthold Klaus Paul Horn*** from year 1981 (first computer book I ever bought). Errata: diagram has 10 MOhm when … | |
I need to write a program that implements Newton's method ((guess + x/guess) / (2)). The program should prompt the user for the value to find the squareroot of (x) and the number of times to improve the guess. Starting with a guess value of x/2, your program should loop … | |
I am working on an assignment in college using RUR-PLE as a starting program. I don't know if you know what that is or not, but I was wondering how to use it? I enter in this code: x = input("How many beepers are in this maze?") def place_all(): repeat(put_beeper,totalBeepers) … | |
This PySide (PyQT) code sample shows you how to apply a StyleSheet to a GroupBox containing a number of RadioButtons. |
The End.