Pseudocode
PYTHON DICTIONARY
CommentsData typesVariablesIf ElseIf Elif ElseFunctionsFor loopWhile loopData structuresString slicing/indexingUser defined functionLocal/Global variableValidation and TryMethodsFile I/OPseudocodeModules |
What is a method?Python challenge - String method - upper()Enter the following code in a Python code editor. Before running the code, what do you think it will do? Press "F5" then "Enter" to run
Try the code again but change .upper() to .title(). What happens?
Python challenge - List method - append()Enter the following code in a Python code editor. Before running the code, what do you think it will do? Press "F5" then "Enter" to run
Change the method from .append to .remove("bread") and then print the list again.
Useful String Methods - But what do they do?
.upper()
.upper() returns the uppercase version of the string .Lower()
.lower() returns the lowercase version of the string .swapcase()
.swapcase() returns a duplicate of the string where the case of each letter is switched .title()
.title() Returns a new string where the first letter of each word is a capital letter and the rest of the letters are lowercase Python challenge - format method - format()Enter the following code in a Python code editor. Before running the code, what do you think it will do? Press "F5" then "Enter" to run
What happens? Run it again but change the number from 2 to 1 {} is a place holder and the 3 avengers exist in specific locations Python challenge - format method - format()Enter the following code in a Python code editor. Before running the code, what do you think it will do? Press "F5" then "Enter" to run
What happens? Change the order of the numbers and run it again
Python challenge - format method - format()Enter the following code in a Python code editor. Before running the code, what do you think it will do? Press "F5" then "Enter" to run
What happens? The first number in each of the three the place holders is a location of one of the super heroes. Change 15 to 30 inside one of the place holders, what happens?
Python challenge - format method - format() to make a tableEnter the following code in a Python code editor. Before running the code, what do you think it will do? Press "F5" then "Enter" to run
What happens? Add another phone to the array. If you add another category e.g. price, then be sure to update the {} place holders and the "eachPhone[location]" details. FYI, the "\n" creates a blank line between the titles and the content.
Python challenge - split methodEnter the following code in a Python code editor. Before running the code, what do you think it will do? Press "F5" then "Enter" to run
What happens? What data structure is displayed by the second to last line? What does the last line of code display?
All commas (,) have been replaced by a hyphen (-). Does the output by the last two lines of code change?
Python challenge - split methodEnter the following code in a Python code editor. Before running the code, what do you think it will do? Press "F5" then "Enter" to run
What happens? What data structure is displayed by the 3 lines before the print function?
|