# What is a string?
# = a sequence of characters

# A. Let's say now that we want to take a string and
# print the characters, one at a time, each on a separate line

# What do we need:
#  = a new statement called the for statement that lets us
#  REPEAT a set of Python statements, for some fixed number of times

# = Iteration with for loop
# for is a keyword

# Basic syntax
# ------------
#
# for iteration_variable in sequence: 
#    statement 1
#    statement 2
#    ....
#    statement n
#
# key thing
#   1. we need a COLON at the end of initial
#   2. each statement "inside" the loop must be indented
#   (convention is 4 spaces)

fruit  = raw_input("What is your favorite fruit? ")
#print fruit

for letter in fruit:
    print letter,  # try with and without the comma

print    
print "done"

# B. What if we now take a string and construct a REVERSED copy of it
# It is tricky

fruit = raw_input('What is your favorite fruit? ')
new_string = ''
for letter in fruit:
    new_string = letter + new_string
print new_string