[Tutor] Sys.argv read parameters
Danny Yoo
dyoo at hashcollision.org
Wed Apr 17 22:03:49 CEST 2013
What's the part that's "changing"? What's the part that stays the same?
I would recommend thinking of this in terms of a function.
Can you write a function that consumes a letter l and returns the
string "This is ..." where "..." is the uppercased l?
As an example of a simple function on strings:
##########################
## double: string -> string
def double(x):
return x + x
## For example, a blast from the past:
print "The Noid says: " + double("pizza")
##########################
There are functions in Python standard library that know how to do
things to strings. See:
http://docs.python.org/2/library/stdtypes.html#string-methods
More information about the Tutor
mailing list