3,386 Posted Topics

Member Avatar for ddanbe

My formatting of your calculations (notice that `len` is builtin function do not use it as variable name): """ calc_polyarea.py Calculating area and radius of polygons with known number of sides and the length of this side Adapted formulas used from this site: http://www.mathwords.com/a/area_regular_polygon.htm DM 17/09/2013 (with little help from …

Member Avatar for vegaseat
1
387
Member Avatar for Dani

And Frank do check the signature facility on your profile and add your blog link there. And Turbo Pascal 3 was liberation on MSDOS pcs after starting with "compile, run and pick the report print from shelf" Burroughs Standard Pascal in 1985.

Member Avatar for seblake
0
1K
Member Avatar for Rayon_1

Memberlist looks simply the length of list which is trivial. First case could use that with findall.

Member Avatar for TrustyTony
0
201
Member Avatar for lucpet

I am not such a friend of banners but here is one version for you to learn some other features of Python (as you did mention format in your title) >>> def banner(filename, name, d, m, y=2013, width=80): print '#' * width print '''\ # Filename: {filename} # Copyright: {name} …

Member Avatar for lucpet
0
215
Member Avatar for happygeek
Member Avatar for Samuel Baker
1
817
Member Avatar for rabbit337

What is this printout is supposed to mean? [CODE] Enter a Node (9999 to finish)>1 Enter a Node (9999 to finish)>1 Enter a Node (9999 to finish)>2 Enter a Node (9999 to finish)>21 Enter a Node (9999 to finish)>1 Enter a Node (9999 to finish)>2 Enter a Node (9999 to …

Member Avatar for sonu_1
0
1K
Member Avatar for Jacklittle01
Member Avatar for james.lu.75491856
0
431
Member Avatar for Jacklittle01
Member Avatar for farmwife

My little more advanced examples are in this code snippet: http://www.daniweb.com/software-development/python/code/364647/jail-input-and-looping-exercise

Member Avatar for james.lu.75491856
0
244
Member Avatar for farmwife

Just for reference in future, that if you are not required to avoid it you can of course do this in standard way: a = raw_input('Type something to be reversed and hit enter: ') print('Your text in reverse is: "' + a[::-1] + '"')

Member Avatar for james.lu.75491856
-1
178
Member Avatar for TrustyTony

Here is exercise in error handling, while looping and for looping with itertools.chain. It is also exercise of functions not letting user to go without giving proper input. I call them to myself 'jail functions'. Here you could add as an exercise breaking out of loop and continuing until user …

Member Avatar for farmwife
0
1K
Member Avatar for james.lu.75491856

This looks like you are using class, not class instance, so the instance variable is not initialized.

Member Avatar for james.lu.75491856
0
166
Member Avatar for Reethu_1

Define the Node to keep reference of last created object and make it return that if node value is same as last before in the `__new__` class method or define Node as a factory function doing the same.

Member Avatar for TrustyTony
0
811
Member Avatar for lionaneesh
Member Avatar for mail2sanjay
1
876
Member Avatar for dreking6

You are trying to get integer from the box even it has not yet been entered. You are reimporting Tkinter, even you imported it all to main namespace in the beginning.

Member Avatar for dreking6
0
2K
Member Avatar for vegaseat

The test is quite limited as can be seen from these numbers, not accepted: 1e3 2+4j 0b01101 0x123abc and these numbers not numbers 1.2.2.3.4+.+ 9-2-34..123 If you want to be very general, you can use test: def is_numeric(n): try: n=complex(n) return True except: try: n = int(n,0) return True except: …

Member Avatar for BearofNH
1
2K
Member Avatar for aVar++
Member Avatar for aVar++
0
133
Member Avatar for vegaseat

Here is alternative format for the code: ''' day_week_born.py ask to enter a birthday and show the day of the week the person was born some dates in history ... July 4, 1776 was on a Thursday December 7, 1941 was on a Sunday 3/14/1879 was on a Friday (Albert …

Member Avatar for 1baga
3
2K
Member Avatar for james.lu.75491856
Member Avatar for 3e0jUn

Would not the Config file fit? http://docs.python.org/2/library/configparser.html

Member Avatar for james.lu.75491856
0
433
Member Avatar for benwadee

I would recommend to work through all excersices, looks for me that you have been looking but not doing the excersises. You learn mainly by doing the exercises, so you would be stupid not to do those.

Member Avatar for TrustyTony
-1
146
Member Avatar for lewashby
Member Avatar for james.lu.75491856
0
225
Member Avatar for lewashby

It is tkinter in Python3. http://docs.python.org/dev/library/tkinter.html >tkinter.filedialog >Common dialogs to allow the user to specify a file to open or save.

Member Avatar for vegaseat
0
1K
Member Avatar for pythonforlife
Member Avatar for floatingshed

I do not see connection of your code with other codes you posted, it says in class defination for example [CODE]class MyDialog(model.CustomDialog):[/CODE] Which you are not using, even you mention custom dialog in your title

Member Avatar for John_43
0
150
Member Avatar for Tyyppi_77

I think the list contains all programs run by pythonw.exe (probably python.exe has separate list), idle is one of them. The list is propably not files edited with idle.py (I can not check it from work computer).

Member Avatar for Tyyppi_77
0
959
Member Avatar for pythonforlife

Python is indention sensitive, I tried to fix your code. Did I guess it right. So what is your question?

Member Avatar for pythonforlife
0
202
Member Avatar for dancks

Python has sets use those or there is module https://pypi.python.org/pypi/bitarray/ I will look your code later in home, if somebody does not review it before that.

Member Avatar for TrustyTony
0
180
Member Avatar for nytman

You problem comes up now and again here in DaniWeb. Here is some code snippets I wrote long time again that you might want to check: http://www.daniweb.com/software-development/python/code/364647/jail-input-and-looping-exercise http://www.daniweb.com/software-development/python/code/284490/integerfloating-point-string-check

Member Avatar for nytman
0
19K
Member Avatar for DeadH34d

`or` is *shortcut version* and in this case it uses Lisp like philosophy of returning something usefull found instead of True or False. As `or` is true apon first non-zerolike value, it returns that desiding point's value and does not evaluate rest of the expressions, as they can not make …

Member Avatar for Gribouillis
0
409
Member Avatar for entropic3105

Simplest way to play sound is to import webbrowser and do webbrowser.open for the sound file. It uses the associated player for the file type. Other possibility is to for example to use pyGame's sound feature as above related Code Snippet for MIDI files.

Member Avatar for vegaseat
0
369
Member Avatar for Liam_1

... or do not assume that the that program seems to work does not have bugs... (I would not know, as this program is quite unverifyable for me because of repeating code instead of loops)

Member Avatar for TrustyTony
0
707
Member Avatar for Dan_1

Did you check http://www.youtube.com/watch?v=JovR98_BvlI or http://www.youtube.com/watch?v=zjf-SUNVfc0&list=SPAFB3A3B53B58CD26

Member Avatar for JasonHippy
0
1K
Member Avatar for hisan
Member Avatar for chophouse
Member Avatar for entropic3105

There seems to be few alternatives based on simple Googling and not owning Apple hardware myself: http://www.saurik.com/id/5 or http://omz-software.com/pythonista/

Member Avatar for svf_
0
183
Member Avatar for mgold

it would be easier if you could post one specific problem together with the code you wrote. You are familiar with http://dirtsimple.org/2004/12/python-is-not-java.html ?

Member Avatar for snippsat
0
178
Member Avatar for entropic3105
Member Avatar for clouds_n_things

You have infinite recursion to Master, function names should be small_case_with_underscores.

Member Avatar for clouds_n_things
1
314
Member Avatar for Dili1234

Count is Count in your clause in line 8 does not make sense for me, why `:- Counter is 1.`? Why not simple facts like line 1? vowel([a],1).

Member Avatar for TrustyTony
0
2K
Member Avatar for Turo1
Member Avatar for rom.

Here: [url]http://chaos.weblogs.us/archives/164[/url] There was code, which seemed to work. I paste here as it was normal text and messed up if copy pasting (also it had some stupid semicolons I removed): Server: [CODE]import socket import time ANY = '0.0.0.0' SENDERPORT=1501 MCAST_ADDR = '224.168.2.9' MCAST_PORT = 1600 sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, …

Member Avatar for silver.moon.37819
0
2K
Member Avatar for robotakid
Member Avatar for TrustyTony
0
371
Member Avatar for stealthless

initials = set(input("Initials : ").lower()) # unique initials phrase = input("Phrase: ").lower() print(sum(c in initials for c in phrase)) """Output: Initials : VKL Phrase: Victor likes licking people 6 """

Member Avatar for edward.okech.5
0
256
Member Avatar for stealthless

Your indention is incorrect and the line 3 is doing nothing as it is 1, which is not saved anywhere. I do not also understand your example.

Member Avatar for TrustyTony
0
251
Member Avatar for ihatehippies

You should have not have mutable default values if you are not absolutely sure you want use them as for example memoization purpose. Use None instead and use if statement: http://stackoverflow.com/questions/366422/what-is-the-pythonic-way-to-avoid-default-parameters-that-are-empty-lists

Member Avatar for james.lu.75491856
0
805
Member Avatar for jude.caird

True is of course allways true so what else it could print, line 3 does nothing.

Member Avatar for james.lu.75491856
0
173
Member Avatar for 26bm

And 999 out of 1000 times you should not be using this but you have bad design so do not shy away on explaining reason for this trickery, so we may recommend bretter way.

Member Avatar for TrustyTony
0
258
Member Avatar for zaphoenix
Member Avatar for Jacklittle01

global variables are available everywhere after their definiton in a module (and outside the module can be qualified by the module name)

Member Avatar for slate
0
323

The End.