ENGINEER 1D04 Chapter Notes - Chapter 4: Negative Number, Eval, Gnu Readline
scarletotter976 and 37168 others unlocked
4
ENGINEER 1D04 Full Course Notes
Verified Note
4 documents
Document Summary
Text is presented in python as string data type. A string is formed by enclosing some characters in quotation marks. Python could read strings if they were enclosed with either single quotation marks ( ") or double( ) . If you need to get textual input from the user, raw_input should be used instead of input. String is a sequence of characters, to get access to the individual characters that make up the string the operation of indexing needs to be used. When counting the number of characters in a string we always start from zero as the first one, space is also counted as a character. Therefore, the string hello bob , contains 8 characters or elements. In the example the string is assigned to a variable x, therefore using the string itself or the variable when indexing is the same thing. If negative number is used python with count from right to left starting from -1.