ECS 32A Lecture Notes - Lecture 2: Newline, Ascii Art
ECS 32A verified notes
2/30View all
Document Summary
Output is important bc it allows python scripts to interact with other programs. Python uses the print() function to print information to the console. Single or double quotes can be used; as long as they are the same. Print() automatically ends in a newline, but you can change that with named parameter end= Is the special character with a tab. To add comments, use the # character. To get input from the user, use the input() function. To convert a string to an integer, use the int() function. Occurs when variable is not declared beforehand. The computer doesn"t know what the variable is. Occurs when there is a mismatch of the tpe between two variables. I. e. adding an int to a string. Will result in a type error bc num_pizza is a string as denoted by the quotes. Occurs when the syntax is not correct. Occurs when the interpreter crashes; it doesn"t know what to do.