Introduction to Programming Week 5

Revision as of 16:13, 31 March 2011 by Smitschu (talk | contribs) (Created page with '==Summary== The summary is short this week, because most of the new content is in the page on strings. ====Part 1: Strings==== See String. ====Part 2: Objects and Methods…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Summary

The summary is short this week, because most of the new content is in the page on strings.

Part 1: Strings

See String.

Part 2: Objects and Methods

Objects are complex entities that combine the data that make up the entity with the operations or functions that can be performed with it. Methods are functions that are tied to a particular object (or class of objects).

We call methods on objects by writing the object name, then a period, then the method name, then any parameters in parentheses. For example, strings have a method index that returns the index of the first occurrence of a substring. If we wanted to find the first occurrence of 'hat' in a string myString we'd use

myString.index('hat')

Part 3: Igpay Atinlay Inway Ythonpay

We wrote a program that converts sentences to Pig Latin. For details see the class transcript and the message board.

See Also

Invalid username
Login to AoPS