Showing posts with label slice. Show all posts
Showing posts with label slice. Show all posts

Saturday, January 17, 2015

Reversing a String

The simple program below demonstrates reversing a user inputted string.
Basic outline:
  1. User inputs a string
  2. An empty reverse string variable is created
  3. A while loop is utilized to create the reverse string by starting at the end of the user inputted string, using indexing.
  4. The reverse message is printed.

Tuesday, January 13, 2015

Using Tuples (slicing, concatenate)

The following program demonstrates the use of tuples. See the program below for slicing a tuple and concatenating a tuple.