CMPSCW 8 Lecture Notes - Lecture 1: Substring, Boolean Expression, Eval

58 views5 pages
27 Jan 2017
School
Course
Professor

Document Summary

This command moves the turtle forward by the given parameter. Makes the turtle change direction by given parameter. Puts it back down def square(): sparky. forward(50) sparky. left(90) sparky. forward(50) sparky. left(90) sparky. forward(50) sparky. left(90) sparky. forward(50) sparky. left(90) for i in range (4): form of a function. Allows you to repeat the process without having to type the steps out again repeats the commands the given amount of times variables: can have any letters can include _ can have 0-9 cannot start with a number. Takes a number as input and returns its absolute value min() (resp. ,max()) takes arbitrary numbers of inputs and returns the smallest (resp. largest) among them gives quotient gives remainder x**y x to the power of y abs() x=a. Boolean expressions evaluate to true or false often involve comparison operators. In expression containing algebraic and boolean expressions algebraic operators are evaluated first comparison operators are evaluated next this is an assignment not a boolean expression.

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