All data types have specific delimiters: strings use double quotes, dictionaries use curly brackets, lists use square brackets, and integers and floats do not use delimiters. Strings are immutable so to combine them a new variable must be created using the + operator. Lists are mutable so new elements can be added using the append() function or removed using del and the index number. Dictionaries are useful for storing paired data like names and phone numbers, while lists are useful for looping and manipulation. Always research anything unfamiliar by searching online resources.
Download as DOCX, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
83 views
Unit 6
All data types have specific delimiters: strings use double quotes, dictionaries use curly brackets, lists use square brackets, and integers and floats do not use delimiters. Strings are immutable so to combine them a new variable must be created using the + operator. Lists are mutable so new elements can be added using the append() function or removed using del and the index number. Dictionaries are useful for storing paired data like names and phone numbers, while lists are useful for looping and manipulation. Always research anything unfamiliar by searching online resources.
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1
Unit 6 Review
All All All All
quotes, it is a string, not an integer.
Strings are immutable (cannot be changed). Therefore, if we
strings and strings only are in quotes .
dictionaries and dictionaries only are in squiggly brackets { }. lists and lists only are in square brackets [ ]. integers and floats (decimals) are numbers. If an integer is in
wants to add two strings together, we will have to create a new
variable and use + sign. Ex) new_variable = variable1 + variable2
Lists are mutable (can be changed). Therefore, we do not have to
create a new variable. We use the append() function to add new element or del list_name[index number] to remove an element. Note that we can only add one element at a time or else, we will get an error! Ex) aList.append(5) #adds 5 to end of the list
Ex) Del aList[0] #removes the element located at index 0 in the list
Dictionaries are useful for storing data pairs such as name & phone number or item & price. Lists are useful for looping and manipulating.
***If theres something you dont understand (modules, rules,
functions etc), always look it up on Google! Searching for resources is basics of programming***