Skip to content

Instantly share code, notes, and snippets.

View timeowilliams's full-sized avatar

Timeo Williams timeowilliams

View GitHub Profile
@timeowilliams
timeowilliams / coming-soon-part-2-customer-request.markdown
Created June 24, 2022 18:09
Coming Soon Part 2 - Customer Request
@timeowilliams
timeowilliams / Practice Python 4: Adding numbers to lists
Created September 18, 2020 16:18
Practice Python 4: Adding numbers to lists
num = int(input('Enter a number: '))
x = []
count = 1
while count < num:
if num % count == 0:
x.append(count)
count += 1
else:
count += 1
@timeowilliams
timeowilliams / Practice Python 5: List Comparison
Created September 18, 2020 16:17
Practice Python 5: List Comparison
a = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89]
b = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]
lena = len(a) - 1
lenb = len(b) - 1
i = 0
share = []
@timeowilliams
timeowilliams / Practice Python 6: Is it a palindrome?
Created September 18, 2020 16:16
Practice Python 6: Is it a palindrome?
#a = [5, 10, 15, 20, 25, 30, 35, 40]
#b = a[::-1]
#print(b)
isPalindrome = input('Please enter a word: ')
isPalindrome1 = list(isPalindrome) # Converting string to list
@timeowilliams
timeowilliams / Practice Python 7: Using List Comprehensions
Created September 18, 2020 16:15
Practice Python 7: Using List Comprehensions
numbers = [3,6,7,8,10,12,13]
even_numbers = [num for num in numbers if num % 2 == 0]
@timeowilliams
timeowilliams / Practice Python 8: Rock paper scissors
Created September 18, 2020 16:14
Practice Python 8: Rock paper scissors
play = input('Would you like to play rock paper scissors?')
while play == "yes":
user1 = input('Please enter your position(rock, paper,or scissors): ')
user2 = input('Please enter your position(rock, paper,or scissors): ')
#while user1 and user2 != "rock" or "paper" or "scissors":
#user1 = input('Please enter your position(rock, paper,or scissors): ')
#user2 = input('Please enter your position(rock, paper,or scissors): ')
if user1 == "rock" and user2 =="scissors":
print("rock wins")
play = "no"
@timeowilliams
timeowilliams / Practice Python 9: Guess a number
Created September 18, 2020 16:13
Practice Python 9: Guess a number
import random #Importing the random module
actual = random.randint(1, 9)
i = 0 #Setting up the counter/Initialization
guess = input('Try to guess what number I''m thinking about(from 1 - 9): ')
while guess != "exit": # We want this to run until the user enters the word exit.
if int(guess) == actual:
print('You entered the right answer')
elif int(guess) > actual:
print('You entered too high!')
@timeowilliams
timeowilliams / Practice Python 10: Comparing Lists
Created September 18, 2020 16:12
Practice Python 10: Comparing Lists
b = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89]
a = [1,1,2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]
c = []
d = []
if len(a) > len(b):
for i in a:
if i in b:
c.append(i)
elif len(a) < len(b):
@timeowilliams
timeowilliams / Practice Python 11: Is it Prime?
Created September 18, 2020 16:10
Practice Python 11: Is it Prime?
#In this program, I've created the function isPrime(), which allows the user to call the function,
#enter a number, and then immediately see if it is or isn't a prime number.
def isPrime(x):
for i in range(2,x):
if x % i == 0:
test = True
else:
test = False
@timeowilliams
timeowilliams / Python Practice 12: First and Last
Last active September 18, 2020 16:19
Python Practice 12: First and Last
def firstAndLast(a):
c =[]
c.append(a[0])
c.append(a[-1])
print(c)
a = [3, 4, 6, 7, 9]
firstAndLast(a)