Now that I am better understanding '__name__'=='__main__', I need to get advice on one last part. Since you put this in the file as an if statement, some instruction must come after. What do you suggest putting after this statement/is that piece of code ever put into action? In my example below, I've done a few tests like putting a print statement under '__name__'=='__main__' and it isn't printed. I am not sure what to put in this code block.
def MultiplyText(text, multiplier): '''Recieve a S & int. For digits in S, multiply by multiplier and return updated S.''' return ' '.join(str(int(num) * multiplier) if num.isdigit() else num for num in text) def GetUserInput(): '''Get S & multiplier. Test multiplier.isdigit(). Call MultiplyText(text, multiplier)''' text = raw_input('Enter some text: ') while True: multiplier = raw_input('Enter a multiplier: ') try: multiplier = int(multiplier) break except ValueError: continue return MultiplyText(text.split(), multiplier) if '__name__' == '__main__': GetUserInput()
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor