CP104- Final Exam Guide - Comprehensive Notes for the exam ( 82 pages long!)
hayjayshay and 38575 others unlocked
2
CP104 Full Course Notes
Verified Note
2 documents
Document Summary
Comments: comments: notes of explanation within a program, ignored by python interpreter, intended for a person reading the program"s code, begin with a # character, end-line comment: appears at the end of a line of code, typically explains the purpose of that line. Different type: a variable in python can refer to items of any type. Constants: you should use named constants instead of magic numbers, a named constant is a name that represents a value that does not change during the program"s execution, example: Interest_rate = 0. 069: this creates a named constant named interest_rate, assigned the value 0. 069. It can be used instead of the magic number: amount = balance * Turtle: use the turtle. hideturtle() command to hide the turtle, this command does not change the way graphics are drawn, it simply hides the turtle icon, use the turtle. showturtle() command to display the turtle.