851 Posted Topics

Member Avatar for WASDted
Member Avatar for TrustyTony
Member Avatar for vuyiswamb

Actually some people look better old, of course their is always a face-lift and a tuck here and there.

Member Avatar for vuyiswamb
1
237
Member Avatar for sneekula
Member Avatar for bf2loser

The strip() function only removes leading and trailing characters: [code=python]text = 'goodbye! cruel, harsh world!..?' print text.strip('!,.?') # goodbye! cruel, harsh world [/code]To remove characters all through the text you can use a loop this way: [code=python]text = 'goodbye! cruel, harsh world!..?!' stripped_text = "" for c in text: if …

Member Avatar for sachin004
0
3K
Member Avatar for rickyfre
Member Avatar for rickyfre
0
399
Member Avatar for siddiqui_1985
Member Avatar for steven woodman
Member Avatar for jingda
Member Avatar for Lardmeister
0
372
Member Avatar for mukthyar1255

Here is a good example of the use of [CODE]if __name__ == '__main__':[/CODE] at: [url]http://www.daniweb.com/software-development/python/threads/20774/161504#post161504[/url]

Member Avatar for Lardmeister
0
307
Member Avatar for epdmcoatings
Member Avatar for e-papa

Here is a simple oldie: [code]''' example of simple encoding/decoding using rot13 where the alphabet is shifted by 13 positions to 'nopqrstuvwxyzabcdefghijklm' so 'a' becomes 'n' and so on (non-alpha characters are not affected) note: Python2x actually had this built in ''' # here is a way to implement this …

Member Avatar for vidur
0
207
Member Avatar for waterfox12
Member Avatar for Behseini

Another example: [url]http://www.daniweb.com/software-development/python/threads/191210/868247#post868247[/url] and for multiple items selection: [url]http://www.daniweb.com/software-development/python/threads/191210/886306#post886306[/url]

Member Avatar for Lardmeister
0
9K
Member Avatar for [V]

Just a hint: [code]# use module re to find index values import re s = "HHHHHHooooooooooooooooHHHHHHHH" rcp = re.compile("H+") print(s) # index help line print('0123456789'*3) print('-'*30) for item in rcp.findall(s): print item found = re.search(item, s) # span() returns (start, end) end is exclusive print found.span() '''check the hint HHHHHHooooooooooooooooHHHHHHHH …

Member Avatar for Lardmeister
0
209
Member Avatar for jingda

I guess one could write a computer program to come up very decent poems.

Member Avatar for iamthwee
0
174
Member Avatar for Python Joe
Member Avatar for Dean_Grobler
Member Avatar for Lardmeister
0
203
Member Avatar for Lardmeister

Tuples are immutable objects, they cannot be changed says the Python manual. [code]my_tuple = (1, 2, 3, [4, 5, 6]) # this works my_tuple[3][2] = 7 # clearly the item at index 3 in the tuple has changed print(my_tuple) # (1, 2, 3, [4, 5, 7]) [/code]

Member Avatar for vegaseat
0
187
Member Avatar for Pendukeni

Without a doubt it is Eli Manning, who could throw a football 80 yards and make it pass though an opening the size of a basketball hoop.

Member Avatar for jingda
0
163
Member Avatar for Ancient Dragon

Looks like the Brits came up with something worthwhile. The prince picked one fine lass, I must say!

Member Avatar for Lardmeister
0
176
Member Avatar for jingda
Re: UFO?

Hoax of any kind is probably closer to the truth, but outer space visitors sound so much more like fun!

Member Avatar for Lardmeister
0
409
Member Avatar for jingda

Earthlings have a totally unneeded appendix, did that come from the alien?

Member Avatar for predator78
0
251
Member Avatar for skald89
Member Avatar for oalee
0
183
Member Avatar for mrnutty
Member Avatar for JhonMoney
Member Avatar for Lardmeister

I am having a problem setting the initial value in the new Tkinter tix module. Can anyone help me out? [code]# explore the tix.ComboBox() # the Tix (Tk Interface Extension) module comes with the # Python27 and Python31+ installation try: import Tix as tix # Python27 except ImportError: import tkinter.tix …

Member Avatar for Lardmeister
0
1K
Member Avatar for South

You cannot subtract strings, but you can cast them to integers and then it will work. [code]a = raw_input("Enter name: ") b = int(raw_input("Enter the year you were born: ")) c = int(raw_input("Enter the year it is now: ")) print "You,",a,",are ",c - b,"years old." [/code]

Member Avatar for South
0
133
Member Avatar for Ephexeve

You can also go through "Projects for the Beginner" right here: [url]http://www.daniweb.com/software-development/python/threads/32007[/url]

Member Avatar for Ephexeve
0
229
Member Avatar for e-papa

Permutations of words are actually fun: [code]# permutations using Python module iterools # needs Python26 or higher # itertools.permutations(iterable[, r]) is a generator/iterator import itertools as it word = "rats" # default is len(word) for p in it.permutations(word): # join tuple p to form a string print( p, ''.join(p) ) …

Member Avatar for e-papa
0
726
Member Avatar for sbiren

Not so fast e-papa! [code]def main(): return 'something' main(2) # TypeError: main() takes no arguments (1 given) [/code]

Member Avatar for richieking
0
176
Member Avatar for Voidz

Development time of a fair sized project is usually ten time faster with Python (a high level language) than with C++ ( a low level language).

Member Avatar for e-papa
0
279
Member Avatar for JetsFan

A computer savvy accountant, that sounds like one of those over-bonused Wall street jobs!

Member Avatar for zekish
0
204
Member Avatar for vmanes

I am not old enough to drive, but I would love to put this sticker on my car: [B]I Lie To Pollsters[/B]

Member Avatar for Lardmeister
0
600
Member Avatar for Michael_Knight

[B]Remember to hold hands and cherish the moment, for someday that person will not be there again.[/B]

Member Avatar for happygeek
0
1K
Member Avatar for vegaseat
Member Avatar for JamieLynnSEO
0
1K
Member Avatar for sravan953

Try to change your print line to: print ("The sum of "+str(a)+" and "+str(b)+" is: "+str(a+b)) or even better: print ("The sum of %s and %s is: %s " % (a, b, (a+b))) Now remember in Python2 input() returns a number and Python3 input() returns a string. In either case …

Member Avatar for mak.smash
0
958
Member Avatar for jake1496
Member Avatar for bumsfeld

It's a tough game despite all the padding, protective gear and helmets. A lot of injured players need replacing.

Member Avatar for diafol
1
162
Member Avatar for sneekula

The overuse of antibiotics will eventually lead to very aggressive super bugs that cannot be treated any longer.

Member Avatar for bumsfeld
2
935
Member Avatar for Lardmeister

This short C# code will calculate the fibonacci number of an integer and display the result in a Windows GUI label.

Member Avatar for nive.s
0
504
Member Avatar for ~s.o.s~

I was almost married twice, but then got scared of the "... till death do us part" thingy! I just enjoy my freedom too much!

Member Avatar for Borzoi
0
726
Member Avatar for christina>you

It has been said that the US president is basically a dictator with a four year term.

Member Avatar for Future_Dictator
0
1K
Member Avatar for G-nerd

A simpler way is to convert the list of [english, spanish] lists to a dictionary of english:spanish pairs: [code]def eng2spanish(text, data): ''' takes each word from an english text and prints out the spanish word given in data if the word is not found it prints the default '---' ''' …

Member Avatar for Lardmeister
0
234
Member Avatar for serkan sendur
Member Avatar for ana12

[QUOTE=Ancient Dragon;1159764]Any time is a good time for pasta :)[/QUOTE]Pasta fagioli, yum, yum!

Member Avatar for dexter737
-11
324
Member Avatar for Rashakil Fol

Why does Haskell give such huge executable files? I compiled a simple "Hello world!" program using 'ghc --make hello.hs' and came up with an 'hello.exe' file of over 700 kb!

Member Avatar for v6ak
0
348
Member Avatar for Sabryan

She said, 'For my birthday I want something sporty that goes from 0 to 150 in about 3 seconds.' He bought her a bathroom scale.

Member Avatar for ih8bugz
0
210
Member Avatar for terence193

An elderly man had serious hearing problems for many years. He went to hearing specialist who was able to have him fitted for a set of hearing aids that gave him perfect hearing again. The elderly man went back after a month to see the specialist who asked him, "Is …

Member Avatar for vegaseat
0
885
Member Avatar for d and d addict
Member Avatar for Agilemind
1
121

The End.