This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ 1.) Understand the problem | |
| Make a two-player Rock-Paper-Scissors game. | |
| 2.) Plan a solution | |
| Algorithm: | |
| - Ask player 1 for input either rock paper or scissors | |
| - tell the player what he chose | |
| - Ask player 2 the same thing and tell them what they chose | |
| - while True: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """1.) Understand the problem | |
| Ask the user for a string and print out whether this string is a palindrome or not. | |
| (A palindrome is a string that reads the same forwards and backwards.) | |
| 2.) Plan a solution | |
| Algorithm: | |
| - Treat the string as a list | |
| - Iterate through the list | |
| - if the string is equal forwards as it is backwards |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """1.) Understand the problem | |
| Get user input's number. | |
| print out a list of all divisors of that number | |
| 2.) Plan a solution | |
| Algorithm: | |
| - Make a new list | |
| - Get user input put it into a variable | |
| - Turn the variable into an integer | |
| - Make a range starting from the number - (number - 2), up to number - 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ 1.) Understand the problem | |
| a = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89] | |
| and write a program that prints out all the elements of the list that are less than 5. | |
| 2.) Plan a solution | |
| Algorithm: | |
| - Create new empty list | |
| - For loop to iterate over each element | |
| - If element < 5: | |
| - Append the element into new list |