1,175 Posted Topics

Member Avatar for revenge2

re Q1: In this case you want to make sure that guess will be an integer, even if the user enters a floating point number. Actually with Python30 the int() becomes very important, since input() now returns a string. re Q5: This shows you the danger of using global. When …

Member Avatar for mn_kthompson
0
363
Member Avatar for StarZ

You will have to add a few extra print statements to space it out: [code=python]import random house =["Mansion", "Apartment", "Shack", "House"] spouse =["EMPTY", "EMPTY", "EMPTY", "EMPTY"] car =["EMPTY", "EMPTY", "EMPTY", "EMPTY"] kids =["0", "1", "2", "5"] print "Enter the name of three people you could marry: " name1 = raw_input("Name1: …

Member Avatar for sneekula
0
595
Member Avatar for krammer

Also, Python30 should give you an error if you use the print statement instead of the print function. Do you find pycurl easier to use than the usual cookielib and urllib2 modules that come with Python?

Member Avatar for krammer
0
1K
Member Avatar for The Dude
Member Avatar for Ghostenshell

Re: Why does it make another file with the ending ".Pyc" at the end? When you saved your class module as awclassPet.py, then Python will also create a compiled bytecode version of this file the first time it is used by an application. The precompiled file awclassPet.pyc will speed things …

Member Avatar for Stefano Mtangoo
0
134
Member Avatar for revenge2

If I would be a beginner, I would simply start with Python30 and Swaroop's online tutorial book. If you bump into old code and have compatibility problems ask, there are enough old timers here to help. Or you could always try the 2to3.py utility that comes with Python30. Enjoy our …

Member Avatar for Stefano Mtangoo
0
468
Member Avatar for revenge2

[QUOTE=revenge2;768841]ok so, just practising here sorry for useless console app but why not use {} to separate blocks. [CODE]number = 2 guess = 2 if number == guess: print ('yep its identicle') [/CODE] when i run that it says indentation error, but when i do [CODE]number = 2 guess = …

Member Avatar for mn_kthompson
0
122
Member Avatar for nrupparikh

There is "no beauty" in even simple C code! Let's all thank the Python development team for giving us a readable syntax. Come to think of it, they all were very fluent in C since the core of Python is writtten in C. I guess the true beauty of C …

Member Avatar for Aia
-1
151
Member Avatar for kanaku
Member Avatar for sneekula
Member Avatar for debasisdas
0
75
Member Avatar for Jenniferlinn
Member Avatar for debasisdas
0
121
Member Avatar for whipaway
Member Avatar for The Dude
1
346
Member Avatar for GrimJack

[QUOTE=Aia;725513]It didn't take very long for my words to be proved. ;)[/QUOTE]You won, congratulations!

Member Avatar for GrimJack
0
1K
Member Avatar for revenge2
Member Avatar for cohen
Member Avatar for stephen84s
0
127
Member Avatar for sillyboy
Member Avatar for lllllIllIlllI

Take a stare at: C:\Python30\Tools\Scripts\2to3.py and use something like: 2to3 -w example.py

Member Avatar for Stefano Mtangoo
0
117
Member Avatar for The Dude

A real sick place! However, in my place someone attempted to karate kick (as seen in some movie) my front door in two days before xmas to steal my meager xmas presents. One way to get presents for your loved ones!

Member Avatar for The Dude
0
87
Member Avatar for lllllIllIlllI

There is a small introduction at: [url]http://www.daniweb.com/forums/post764519-155.html[/url]

Member Avatar for lllllIllIlllI
0
115
Member Avatar for ZZucker
Member Avatar for AstralCorpse

If the word you enter is 'xp11' then it will do that. BTW you don't have to subtract one from wordsize, randrange() work like range(). Give it a test: [code=python]import random #word = raw_input("Enter a word: ") word = "consumer" wordsize = len(word) for k in range(10): randomnumber = random.randrange(0, …

Member Avatar for mn_kthompson
0
135
Member Avatar for Michigan_Guy
Member Avatar for sneekula
0
100
Member Avatar for techbound
Member Avatar for madhatter84gn

[QUOTE=mn_kthompson;763291]What I mean by code blocks are specific to this board. When you post code on the board you should enclose the code in code tags so that it is more readable. You are correct that in the Python language code is grouped together by indentation only. The difference between …

Member Avatar for sneekula
0
123
Member Avatar for StarZ

You can do it this way ... [code=python]house= ["computer", "laptop", "tv", "nintendo DS", "table", "Empty"] print "items in my house are:" print house menu = """\ Pick an item to fill in the empty space: 1 - Lamp 2 - bed 3 - NDS q - to quit """ print …

Member Avatar for StarZ
0
119
Member Avatar for Rejinacm
Member Avatar for sneekula
0
140
Member Avatar for christina>you
Member Avatar for techbound
0
484
Member Avatar for tutti
Member Avatar for rebekkajoost

[QUOTE=rebekkajoost;761649]Sorry if I am post in "/forums/forum152.html" category, but I am think it's the most suitable. Stay not long time before christmas and happy new years holidays. I am have big famaly and now I am even not know what kind of gifts make to my friends and famaly. So …

Member Avatar for sneekula
0
155
Member Avatar for venomlash

What is your price range? If yo have XP now, prepare to get used to Vista, but then Linux would be even a steeper learning experience. Why not Dell? I am happy with my hand-me-down Sony Multimedia machine.

Member Avatar for techbound
0
207
Member Avatar for dseto200

Murtan's code is the cleaner code. In paulthom12345's code range(len(w1)) changes as w1 gets shorter, always a dangerous thing to do in a for loop. If you want to use one more random option, here it is: [code=python]import random w1 = ["abacus", "biology", "chemistry", "dog", "elf", "ghost"] # make a …

Member Avatar for dseto200
0
88
Member Avatar for Rejinacm

One way to do this: [code=python]# creates variables qq1 - qq4 and initializes to 77 for i in range(1, 4): exec "%s = %d" % ('qq' + str(i), 77) print qq1 # 77 [/code]

Member Avatar for paddy3118
0
116
Member Avatar for Rejinacm
Member Avatar for sneekula
0
56
Member Avatar for Rejinacm

[QUOTE=Rejinacm;759268]what is the reason why Python doesn't have switch statement ?[/QUOTE]Even in C the switch/case is not as efficient as multiple if/else and the cases are rather limited. Actually, a dictionary makes an excellent replacement for a switch/case and is very high speed on the lookups: [code=python]# a dictionary switch/case …

Member Avatar for sneekula
0
137
Member Avatar for codedhands
Member Avatar for tomtetlaw
Member Avatar for adam291086

******() is not allowed as a function name. A function name has to start with a letter or an underscore and can contain numbers.

Member Avatar for adam291086
0
76
Member Avatar for happymadman

You could also use: [code=python]def fuzzy_equals(a, b, delta=0.0001): """ returns true if (b-delta) < a < (b+delta) used for comparison of floating point numbers a and b """ return abs(a-b) < delta [/code]Adjust your delta to suit you.

Member Avatar for sneekula
0
101
Member Avatar for cyberjam39

Just a note, don't use function names like list as variable names. [code=python]mylist = ["very", "hot", "day"] print "".join(mylist) # veryhotday # or use this, might be more descriptive for a beginner # empty string s = "" for word in mylist: # concatenate words s += word print s …

Member Avatar for sneekula
0
108
Member Avatar for Lardmeister
Member Avatar for lllllIllIlllI

[QUOTE=paulthom12345;725842]Is there anywhere to download pysonic for python 2.5? Because i cant find it on the sourceforge page..[/QUOTE]Find file pysonic.pyd installed on Python24 and copy it to Python25 pysonic will work with python25 if you hexedit pysonic.pyd --> find the python24.dll ref. and change it to python25.dll you can use …

Member Avatar for lllllIllIlllI
0
3K
Member Avatar for The Dude
Member Avatar for The Dude
Member Avatar for sneekula

Since anyone of us main street beings knows more about the real economy than 400 Wall Street kissing economy professors combined, here is a look how to present the state of the economy: [url]http://www.thedailyshow.com/video/index.jhtml?videoId=186052&title=clusterf#@k-to-the-poor-house[/url]

Member Avatar for GrimJack
0
369
Member Avatar for MaxVK

Since I don't have any of the many versions of Linux, I can not test wx.Clipboard. I think it would be easier to store your text in a file for use across programs. If you use a wx.TextCtrl, can you highlight, rightclick and copy/cut and paste from the popup menu? …

Member Avatar for MaxVK
0
145
Member Avatar for apsu

Please use code tags around your code. Something like this will do the summation: [code=python]sum = 0 n = 1 while n < 101 : sum += n print n, sum n = n+1 [/code]Note that sum += n is the same as sum = sum + n Proper code …

Member Avatar for apsu
0
110
Member Avatar for allena

San Diego California has the nicest weather in the USA. When the big one comes, it will fall into the ocean, so what!

Member Avatar for Vladimirr
0
213
Member Avatar for Lardmeister

If John McCain starts smiling a lot at times when he really isn't supposed to, a Ron Paul (M.D.) and Bob Barr ticket might be the alternative for the GOP.

Member Avatar for jbennet
0
3K
Member Avatar for Lardmeister
Member Avatar for The Dude

We need a big government program to find the missing cold, so we can fight global warming.

Member Avatar for Dave Sinkula
0
973

The End.