CMPT-101 Lecture 5: Functions and Characters

130 views2 pages

Document Summary

Adding t after a backslash in a statement adds a tab space. Adding n after a backslash in a statement adds a new line. Print is the command in python used to display whatever in inside the parentheses following print. Replaces the end of a line of a print function with something else. Where a print function would normally end and make a new line for the next print function, including end=" " for example would replace this with a space. >>>print("how are you today") hello how are you today. Outside of a string, but inside of a line, we can use this to replace the spaces (again, the spaces outside of a string) with whatever the value of sep is. >>>print("this is the story of", name, "who lives in alberta. ", sep="--") this is the story of--bob--who lives in alberta.

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