Skip to content

Instantly share code, notes, and snippets.

@InquisitiveDev2016
InquisitiveDev2016 / RockPaperScissors.py
Last active August 12, 2022 10:33
Make a two-player Rock-Paper-Scissors game.
""" 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:
@InquisitiveDev2016
InquisitiveDev2016 / StringListsPalindrome.py
Last active October 4, 2023 17:12
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.)
"""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
@InquisitiveDev2016
InquisitiveDev2016 / Divisors.py
Created February 19, 2017 20:07
Create a program that asks the user for a number and then prints out a list of all the divisors of that number.
"""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
@InquisitiveDev2016
InquisitiveDev2016 / ListLessThan10.py
Created February 19, 2017 19:07
Given a sample list print out all elements less than 5.
""" 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