CISC 101 Lecture Notes - Lecture 3: Turtle Graphics, For Loop

44 views4 pages
Department
Course
Professor

Document Summary

Loops and lists: the turtle starts in the home position (0,0, right(num_degrees) # clockwise left(num_degrees) # counter clockwise speed (from 1 to 10) Loop counters are one way of stopping a loop. Break, continue, else, pass: continue causes the code to continue past the loop, pass is useless. Introduction to the for loop: takes more code to carry out the operation, for variable_name in iterable : Len() is a bif that gives you the length of a string. [] is (cid:272)alled the (cid:862)sli(cid:272)e operator(cid:863) a(cid:374)d retur(cid:374)s a si(cid:374)gle ele(cid:373)e(cid:374)t (cid:894)or (cid:272)hara(cid:272)ter(cid:895) fro(cid:373) a (cid:272)olle(cid:272)tio(cid:374) Python"s collections: built in collection types are: lists, tuples, sets, dictionaries, strings are just kinds of tuples, a list is a liter enclosed in [, a tuple literal is enclosed in () Lists & tuples can hold multiple types: you cannot do atuple[1] = 7 (cid:894)it"s i(cid:373)(cid:373)uta(cid:271)le(cid:895, mtlist() and mttuple() create empty lists and empty tuple.

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