CMPT 120 Lecture 6: Week 6 Notes (Oct,14,16)

22 views8 pages
meghan78 and 39786 others unlocked
CMPT 120 Full Course Notes
29
CMPT 120 Full Course Notes
Verified Note
29 documents

Document Summary

To access individual characters in a string we use an index operator in a for loop. Ex. fruit = apple for idx in range(5): current_char = fruit[idx] print(current_char) A will be printed first since the index is 0. Then the next index will be printed which is p . Every window contains a canvas, which is the area inside the window on which we can draw. The method invocation alex. color( red ) will make alex red and the line that it draws will be red too. The color of the turtle, the width of its pen(tail), the position of the turtle within the window, which way it is facing, and so on are all part of its current state. The wn variable refers to the window shown above. When we invoke its exitonclick() method, the program pauses execution and waits for the user to click the mouse somewhere in the window.

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