851 Posted Topics

Member Avatar for Nation
Member Avatar for diafol
Member Avatar for MasterChat

Chicago is heading for a high of -18 Celsius! I bet the crime rate is dropping.

Member Avatar for RobertHDD
0
189
Member Avatar for Slavi
Member Avatar for vegaseat

To install the PySide package on Linux use for Python2 --> `sudo apt-get install python-pyside` or for Python3 --> `sudo apt-get install python3-pyside`

Member Avatar for Lardmeister
3
3K
Member Avatar for Chem_1
Re: IDE

WinPython for Python 3.4 is at: http://sourceforge.net/projects/stonebig.u/files/Winpython_3.4/

Member Avatar for sneekula
0
679
Member Avatar for chloe.baee

Count the number of sleeping students. If it's more than 50% your teaching is boring.

Member Avatar for Agilemind
0
429
Member Avatar for Reverend Jim

My suggestion would be to go with the coming year, so it would be Windows2015.

Member Avatar for smartjulie85
1
500
Member Avatar for krishna bharath

I like this one: w, x, y, z = 1, 2, 3, 4 if w < x < y < z: print("w={} x={} y={} z={}".format(w, x, y, z))

Member Avatar for HiHe
-2
350
Member Avatar for Lardmeister

String input has changed from Python2's raw_input(prompt) to Python3's input(prompt). The old Python2 numeric input(prompt) has gone away with Python3, all input is now string input. The snippet shows a few lines you can add to your program such that you only need to use input(prompt). This makes your code …

Member Avatar for vegaseat
2
222
Member Avatar for Lardmeister

Just another one of those silly polls. This one asks you to list the country that most associates with the type of food (or drink) you like.

Member Avatar for vegaseat
1
298
Member Avatar for vegaseat

To get used to wxPython, I took vegaseat's mortgage calculator snippet written in Csharp and converted it to Python. I was surprised how easy it was: [code=python]# a simple mortgage calulator using wxPython # checked it out with the online mortgage calculator at: # http://www.mortgage-calc.com/mortgage/simple.php import wx import math class …

Member Avatar for HiHe
2
21K
Member Avatar for Lardmeister

Does anybody have some experience with the iPython notebook? How do you get started?

Member Avatar for bumsfeld
0
296
Member Avatar for bumsfeld

Here is a typical example: class Accumulator(object): ''' remembers self.n __call__() allows the class instance to be called as a function ''' def __init__(self, n=0): self.n = n def __call__(self, x): self.n += x return self.n # create an instance and initialize data = 4 acc = Accumulator(4) # remembers …

Member Avatar for bumsfeld
0
3K
Member Avatar for vegaseat
Member Avatar for Lardmeister
5
3K
Member Avatar for Screwby

Double click on the source code and it will highlight. Then copy and paste without the line numbers.

Member Avatar for Lardmeister
0
11K
Member Avatar for psichoman5

Interesting problem. You might want to test your functions one by one. ''' str_8bits.py represent a string in bytes of 8 bits ''' def string2bits(s): ''' convert a string of characters s to a string of 8 bits per character ''' b = "" for c in s: b += …

Member Avatar for Gribouillis
0
2K
Member Avatar for kuchi
Member Avatar for Pyler
Member Avatar for Lardmeister
0
395
Member Avatar for nitin1

A header file makes sense if you take into account future changes to the language.

Member Avatar for Lardmeister
0
235
Member Avatar for Santanu Das

As I understand this: purchase_price = 50 selling_price = 100 - 10 gain = 40

Member Avatar for ElliotNorton
-6
181
Member Avatar for saimasiddiqui

Hint --> flowers = ['rose', 'bougainvillea', 'yucca', 'marigold', 'daylilly', 'lilly of the valley'] flowers2 = ['rose', 'bougainvillea', 'yucca', 'marigold', 'potato', 'daylilly', 'lilly of the valley'] print('potato' in flowers) # False print('potato' in flowers2) # True Please show some honest coding effort yourself, or you learn nothing and will be just …

Member Avatar for Gribouillis
0
1K
Member Avatar for mcroni
Member Avatar for frankie198

I am using the IDLE IDE that comes with Python 3.4 and it works well for my student needs.

Member Avatar for Jack_9
0
854
Member Avatar for ujjwale

Real programmers learn C. It's fast, free, clean code, and easy to learn. http://www.tutorialspoint.com/cprogramming/cprogramming_pdf_version.htm Tool to use: http://www.codeblocks.org/

Member Avatar for bCubed
0
318
Member Avatar for iAssistant
Member Avatar for ItsAdZy

Editra is a neat Python IDE written in Python. There is a free download from: http://editra.org/

Member Avatar for RogueHaxor
0
1K
Member Avatar for azareth
Member Avatar for liz517
Member Avatar for kcm1
0
1K
Member Avatar for prashantsharmazz
Member Avatar for mike_2000_17
0
527
Member Avatar for debasisdas
Member Avatar for serkan sendur
Member Avatar for Reverend Jim
0
333
Member Avatar for glao

Use either recursion or a while loop, but not both: def lengthR(mystring, count=0): ''' recursive function to count char in mystring excluding spaces ''' if mystring == '': return count mystring = mystring[0:-1] count += 1 if mystring.endswith(' '): count -= 1 print(mystring, count) # test return lengthR(mystring, count) mystring …

Member Avatar for glao
0
193
Member Avatar for nitin1
Member Avatar for stevewilliams02

Something like this usaully works: # Python2 (for Python3 use tkinter) import Tkinter as tk def show_image(): lbl['image'] = image_tk root = tk.Tk() # pick a .gif image file you have in the working folder # or give the full path fname = "House.gif" image_tk = tk.PhotoImage(file=fname) btn = tk.Button(root, …

Member Avatar for stevewilliams02
0
1K
Member Avatar for dark_falzar

You can develop bad habits with any language! There are certain programming rules to follow.

Member Avatar for ryantroop
0
336
Member Avatar for <M/>
Member Avatar for nitin1

Study Java, there are a lot more jobs to have. To get a Python job you have to be very very good. Let us know when you start your third course.

Member Avatar for Lardmeister
0
263
Member Avatar for bryann
Member Avatar for Lardmeister
0
116
Member Avatar for wendas

It is always good not to be tied to just the Microsoft platform. Rather than C# I would rather pick up Java. Once you are familiar with Java, C# will be easy to add.

Member Avatar for Momerath
0
276
Member Avatar for HiHe
Member Avatar for boni_go
Member Avatar for edenrol
0
1K
Member Avatar for 123pythonme

Use a few temporary print() functions to see your problems. The brute force algorithm will take too much time with prime numbers in the higher ranges. So will the many calls to function is_divisible(). See the code snippet: http://www.daniweb.com/software-development/python/code/216871/prime-number-function-improvements-python for improvements and timing results. A sieve algorithm will be much …

Member Avatar for vegaseat
0
581
Member Avatar for goo_1
Member Avatar for RHNation

Study this code, it will teach you how to pass arguments to and from functions: def main(): print('Welcome to the Fast Freight Shipping Company Calculator for Shipping Charges') print() #constants for the shipping prices weight_one_rate = 1.10 weight_two_rate = 2.20 weight_three_rate = 3.70 weight_four_rate = 3.80 #get the weight of …

Member Avatar for Lardmeister
0
4K
Member Avatar for steven woodman

[QUOTE=idrk;1580773]this is stupid[/QUOTE]Sorry bud, not everyone can be as smart as the rest of us!

Member Avatar for stultuske
4
399
Member Avatar for RHNation

I cleaned it up a little for you: def main(): print ('Welcome to the mpg calculator program: \n') # get the miles driven using the input function # input() gives a string so convert with float() miles_driven = float(input ("Please enter miles driven: ")) # get the gallons used using …

Member Avatar for farmwife
0
302
Member Avatar for Varunkrishna
Member Avatar for vegaseat

For hints on deciphering see: http://www.math.cornell.edu/~mec/2003-2004/cryptography/subs/hints.html

Member Avatar for Lardmeister
2
531
Member Avatar for Jacklittle01

You can pickle your code's local or global dictionary, this will save the name and value of each variable.

Member Avatar for Gribouillis
0
248

The End.