CSCA08H3 Lecture 2: CSC108 - Week 2 Notes

180 views5 pages
1 Mar 2016
School
Course
Professor

Document Summary

However, you"re so cold" will return a syntaxerror since the internal single quote prematurely ends the string. This can be xed by changing the containing quotes to double quotes: you"re so cold . Alternatively an escape character/sequence can be used. You\"re so cold. " will return you"re so cold. Cannot add a str to an int or a oat (returns typeerror). Even if the int or oat is in quotations (because that makes it a str like 5"): eg. personal" + penguin" returns personalpenguin". Spaces have to be included in the quotes (eg. personal + penguin" returns personal penguin"): you can also link variables that refer to strings. Example: name = alex" phrase = watch out" punctuation = !" name + phrase + punctuation returns alex watch out!". Strings can be multiplied by ints ( oats or str"s will return typeerrors): eg. ha" * 5 returns hahahahaha", order of operations still takes precedence. Bwa" + ha" * 5 returns bwahahahahaha".

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents