CSC108H5 Lecture Notes - Lecture 3: Computer Data Storage, Substring
CSC108H5 verified notes
3/3View all
Document Summary
Variables: a variable is like a container that stores values that you can access or change. Hence, if the variable is an integer we can only save integers in that variable while running our program. In python if we need a variable we simply declare a name and assign a value to it: example: my_variable = 10. Here, the statement does not mean that my_variable is equal to 10. It means that my_variable is set to 10. To increase the value of the variable we can simply give the command: The output of this command should be like: If we want to store a string in a variable we could do it like: Data types: data types include, strings, numbers, booleans, lists, date, time, strings: It is a sequence of unicode characters that may be combination of letters, numbers and special characters. In python, a string is defined in matching single or double quotes.