ENGINEER 1D04 Chapter Notes - Chapter 4: Newline, Gnu Readline, Eval

41 views4 pages
scarletotter976 and 37168 others unlocked
ENGINEER 1D04 Full Course Notes
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. P(cid:455)tho(cid:374) (cid:272)ould (cid:396)ead st(cid:396)i(cid:374)gs if the(cid:455) (cid:449)e(cid:396)e e(cid:374)(cid:272)losed (cid:449)ith eithe(cid:396) si(cid:374)gle (cid:395)uotatio(cid:374) (cid:373)a(cid:396)ks (cid:894)(cid:858) (cid:859)(cid:895) o(cid:396) dou(cid:271)le(cid:894)(cid:862) (cid:863)(cid:895) . 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. The(cid:396)efo(cid:396)e, the st(cid:396)i(cid:374)g (cid:862)hello (cid:271)o(cid:271)(cid:863), (cid:272)o(cid:374)tai(cid:374)s 8 (cid:272)ha(cid:396)a(cid:272)te(cid:396)s o(cid:396) ele(cid:373)e(cid:374)ts. 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.

Get access

Grade+
$40 USD/m
Billed monthly
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
10 Verified Answers
Class+
$30 USD/m
Billed monthly
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
7 Verified Answers

Related Documents