4,305 Posted Topics

Member Avatar for mrpython1

I would use the Python third party module matplot (pylab), free from: http://matplotlib.org/contents.html For a nice example see: http://matplotlib.org/examples/mplot3d/bars3d_demo.html

Member Avatar for vegaseat
0
535
Member Avatar for >shadow<

The last song count on my IPod was 126. Mostly classic rock and classic jazz.

Member Avatar for stultuske
0
453
Member Avatar for vegaseat

A simple code example to calculate the monthly payment on a mortgage loan. Takes a look at Python's newer print and format functions.

4
9K
Member Avatar for krystosan
Member Avatar for kewlankit

On the Python forum we have listed a whole bunch of projects. Look through them, some will easily apply to C ... http://www.daniweb.com/software-development/python/threads/32007/projects-for-the-beginner

Member Avatar for Miorfs
0
219
Member Avatar for vegaseat
Member Avatar for HiHe
3
640
Member Avatar for krystosan

A model allows you to customize a widget or make it more generic. See ... http://www.daniweb.com/software-development/python/code/447834/applying-pysides-qabstracttablemodel

Member Avatar for krystosan
0
234
Member Avatar for lancevo3

Since you are using a loop with a defined limit, a for loop would be better.

Member Avatar for lancevo3
0
147
Member Avatar for ashish2expert

C header files often include other header files, which include other header files in turn. By chance you might end up with <stdlib.h> included. I would not rely on it!

Member Avatar for vegaseat
0
525
Member Avatar for krystosan
Member Avatar for krystosan

A little different ... names = ['Google', 'Apple', 'Microsoft'] print(["%d %s" % pair for pair in enumerate(names)]) ''' ['0 Google', '1 Apple', '2 Microsoft'] '''

Member Avatar for vegaseat
0
199
Member Avatar for halien
Member Avatar for aVar++

Might as well take advantage of module random ... def make_list2(n): return random.sample(range(1000), n) print(make_list2(10)) In Python2 use xrange() for large numbers. In Python3 range() is a generator.

Member Avatar for vegaseat
0
420
Member Avatar for vegaseat

A short code to show you how you can download and display an image from the internet on Python's Tkinter GUI toolkit.

3
329
Member Avatar for gerswin

You could simplify this a little with ... lines1 = open("Text1.txt").readlines() lines2 = open("Text2.txt").readlines() # set up module difflib diff_instance = difflib.Differ() diff_list = list(diff_instance.compare(lines1, lines2))

Member Avatar for vegaseat
0
305
Member Avatar for kadowling

# Python2 uses raw_input() for strings and input() for numbers # Python3 uses input() for strings # ---------------------------------------------- # add these few lines near the start of you code import sys # make string input work with Python2 or Python3 if sys.version_info[0] < 3: input = raw_input # ---------------------------------------------- programStart …

Member Avatar for vegaseat
0
243
Member Avatar for siga
Member Avatar for vegaseat
0
942
Member Avatar for vegaseat
3
601
Member Avatar for Greyhelm

Reading file "Encontract.txt" does not give you a list. Use something like this ... with open("Encontract.txt") as fin: contrwords_raw = fin.read() # make a list, also removes new line char contrwords = [word for word in contrwords_raw.split()]

Member Avatar for Greyhelm
0
418
Member Avatar for clouds_n_things
Member Avatar for wrathofmobius

As you execute cx_freeze it will actually show what it includes by default. Usually re is in that list. Also look at snippsat's include_files option.

Member Avatar for wrathofmobius
0
8K
Member Avatar for <M/>

The game was great, the entertainment was great, and the commercials had some good moments (Farmers). I had fun and a few beers, and I am still happy.

Member Avatar for <M/>
0
221
Member Avatar for vegaseat

A small test program exploring the PySide/PyQT Label widget. With HTML code you can do some nice formatting of the label's text.

5
749
Member Avatar for vegaseat

The PySide/PyQT QValidator restricts the type of input a widget like QLineEdit can accept. Here is a simple test.

1
714
Member Avatar for Lardmeister

Not on the list ... Sin City Brewing turns out a great tasting local micro-brew. http://www.sincitybeer.com/lasvegasmicrobrewery.html

Member Avatar for vegaseat
0
192
Member Avatar for vegaseat

Another exercise in applied geometry. This time we use the Tkinter GUI canvas and its create_line() function to draw a triangle, or a series of connected triangles to create something that looks like fancy art work. You might be able to impress grandmama with that one!

Member Avatar for vegaseat
1
3K
Member Avatar for krystosan
Member Avatar for mmpal78

Pygame uses the SDL library (written in C++). Looks like one of your SDL files is corrupt or missing. On my Windows box the image handling file is called **SDL_image.dll** There should be a Unix/Linux equivalent.

Member Avatar for slate
0
531
Member Avatar for vegaseat

A function to take a text and extract the string between two given substrings. Allows you to find the nth occurence. Also safeguards against dead ends.

2
1K
Member Avatar for JordanSimps

Here are a few things that need to be improved in your code ... 1) don't import inside the loop or you keep on reimporting 2) don't define a function inside the loop or you keep on redefining 3) all your if statement need to be something like this **if …

Member Avatar for vegaseat
0
259
Member Avatar for bumsfeld

For those who want to minimize typing ... [code]# this saves you from having to add quotes around any strings/characters (keys only) dic1 = dict(a=1, b=2, c=3, d=4) print dic1 # {'a': 1, 'c': 3, 'b': 2, 'd': 4} [/code]

Member Avatar for Umar Suleman
3
410
Member Avatar for mariocatch

Take a look at the C# Scripting Engine project, it's open source. [URL]http://www.members.optusnet.com.au/~olegshilo/index.html[/URL]

Member Avatar for fletcher.cutting.9
0
386
Member Avatar for TBSouth
Member Avatar for TrustyTony
Member Avatar for BigPaw
Member Avatar for Lardmeister
0
699
Member Avatar for nivedita.datta

Data applied to LSH can consist of images, sounds, gene expressions and the like. You generally use LSH to detect similarities.

Member Avatar for vegaseat
0
296
Member Avatar for slasel
Member Avatar for petzoldt01

Looks like the Django gurus are not hiding on DaniWeb. If you find out where they are hiding, please let us know.

Member Avatar for vegaseat
0
195
Member Avatar for ZZucker

Oh yes, J language is powerful but rather cryptic, so I want to salute pyTony for coming up with a solution! I meant to give you this hint ... NB. exploring J lists NB. using J language free from www.jsoftware.com NB. see http://www.jsoftware.com/help/learning/contents.htm NB. create a list of integers 0 …

Member Avatar for TrustyTony
0
176
Member Avatar for Fernando_1

You can aslo use the WYSIWYG approach to format your output ... # Purpose: Tax input amount # #----------------------------------------------------------------------- # VARIABLE DEFINITIONS #----------------------------------------------------------------------- # CONSTANT DEFINITIONS #----------------------------------------------------------------------- # FUNCTION DEFINITIONS #----------------------------------------------------------------------- # PROGRAM'S MAIN LOGIC salesAmount = float (raw_input("Enter the sales amount: ")) salesTax = salesAmount*0.08 total = salesAmount + …

Member Avatar for vegaseat
0
219
Member Avatar for nitin1

Viruses are well supported by their authors, are frequently updated, and tend to become more sophisticated as they mature. So there! Windows is not a virus.

Member Avatar for <M/>
0
204
Member Avatar for vegaseat

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 …

Member Avatar for vegaseat
3
414
Member Avatar for biscayne

If you want to call the appropriate function, do this ... code = prodcust_code[:2] if code == "AB": function_AB() elif code == "CC": function_CC() elif code == "EF": function_EF() elif code == "US": function_US() else: print("No function found for {}".format(code))

Member Avatar for vegaseat
0
239
Member Avatar for ndeniche
Member Avatar for carbonicacid81

You can use the more exact Newton's Method Python version from: http://www.daniweb.com/software-development/python/code/444930/newtons-method-example-python Here is the example for a squareroot solution ... ''' Newton_method2.py find value for x in f(x) = 0 using Newton's method ''' def derivative(f): def compute(x, dx): return (f(x+dx) - f(x))/dx return compute def newtons_method(f, x, dx=0.000001, …

Member Avatar for vegaseat
0
5K
Member Avatar for vegaseat

This PySide (PyQT) code sample shows you how to apply a StyleSheet to a GroupBox containing a number of RadioButtons.

3
3K
Member Avatar for vegaseat

A little fun drawing with the Python module turtle. Well commented to help the beginner.

3
289
Member Avatar for ricepicker417

For a dictionary approach see: http://www.daniweb.com/software-development/python/code/446042/a-matrix-dictionary-python

Member Avatar for vegaseat
0
2K
Member Avatar for flebber

Another look at closure ... ''' closure102.py A nested function has access to the environment in which it was defined. This definition occurs during the execution of the outer function. In a closure you return the reference to the inner function that remembers the state of the outer function, even …

Member Avatar for flebber
0
149
Member Avatar for Frensi

**if event.type == K_BACKSPACE:** does not work properly, replace with **if chr(event.key) == '\x08':** Also blank out the old text before you rewrite it.

Member Avatar for Lardmeister
0
237

The End.