CSCI 1301 Lecture Notes - Lecture 4: Test Case, List Of Association Football Teams To Have Won Four Or More Trophies In One Season, Newline
Document Summary
Each value can be identified by its position in the list. Len() finds the number of items in a list. Listname[x] gives the value of the xth item in the list. Index = the item"s position in the list. Value = the value that goes with a specific index. Write a function that takes in a list and prints each item in that list on a separate lines. Conditionals are used when you want different things done depending on the input. Ex: a function that checks a person"s age before allowing them into a movie. We want to check if their age satisfies a requirement! If statements create their own code block (umbrella) which means that everything you want executed given that a particular condition is true, must be indented underneath the statement and have a colon! How it looks: if a == 5: Write a function that checks a person"s age.