Skip to content

Instantly share code, notes, and snippets.

View MuddyBootsCode's full-sized avatar

Michael Porter MuddyBootsCode

View GitHub Profile
@MuddyBootsCode
MuddyBootsCode / Century.py
Created May 14, 2016 14:30
Practice Python - Character Input
myName = str(input('Hello what is your name? \n'))
myAge = int(input('Well ' + myName + ' I know it\'s a little rude but can you tell me how old you are? \n'))
century = 100 - myAge
print ('Well ' + myName + ' did you know that in ' + str(century) + ' years, you\'ll be 100 years old?\n')
messageRepeat = int(input(myName + ' would you mind giving me another number?\n'))
def OddEven(number):
if number % 2 != 0:
print ('Your number is odd.\n')
elif number % 4 ==0:
print ('Your number is even and a multiple of four.\n')
else:
print ('Your number is even.\n')
number = int(input('I can tell you if a number is even or odd.\nPlease give me a number.\n'))
OddEven(number)
a = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89]
b = []
def LessThanTen(userNumber):
for i in range(len(a)):
if a[i] < userNumber:
b.append(a[i])
print (b)
userNumber = int(input('Please give me a number.\n'))
divisors = []
userNumber = int(input('Please give me a number and I\'ll give you all of that numbers divisors.\n'))
userRange = range(userNumber + 1)
for i in range(len(userRange)):
try:
if userNumber % userRange[i] == 0:
@MuddyBootsCode
MuddyBootsCode / OverLappingLists.pu
Last active May 15, 2016 18:57
Over Lapping Lists - Random Lists
import random
y = random.sample(range(1000), random.randint(1, 100))
z = random.sample(range(1000), random.randint(1, 100))
c = { item for item in z if (item in y)}
print(c)
@MuddyBootsCode
MuddyBootsCode / List Comprehensions
Last active May 15, 2016 20:57
Even Number List Comprehension
a = [1, 4, 9, 16, 25, 36, 49, 64, 81, 100]
evenList = [n for n in a if n%2 == 0]
print (evenList)
userTime = int(input('Give me a number of seconds and I\'ll give you how much time that is back.\n'))
hour = int((userTime / 60) / 60)
minuet = int((userTime / 60) % 60)
sec = userTime - (((hour * 60) * 60) + (minuet * 60))
print(hour)
print(minuet)
print(sec)
#include<stdio.h>
#include<cs50.h>
int main (void)
{
int hgt = 0;// Initialize variable
int i, y;
do
#include<stdio.h>
int reverseDigits(int userNumber);
void sumOriginalReverse(void);
int userNumber;
int main(void)
{
#include<stdio.h>
#include<math.h>
#include<cs50.h> // only for CS50 IDE
int main (void)
{
float change, rnd;
int quarters, dimes, nickles, pennies, coins;