The best known program for learning anything in Python is “Hello, World!”. This is simply done in Python by typing: >>> print “Hello, World!” To assign a value to a user input, use the “raw input” command: >>> age=raw_input(‘How old are you?\n’) >>> print ‘You are %s years old.’ % age Another great Python tool is the “function” feature. Try this program and see what happens: >>> def hug(name): >>> print 'I love you', name >>> name=raw_input('What is your name?\n') >>> hug(name) Downloaded from http://www.wikihow.com
Design a Mobile Website
View Site in Mobile | Classic
Share by: