This file contains 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
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')) |
This file contains 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
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) |
This file contains 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
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')) |
This file contains 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
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: |
This file contains 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
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) | |
This file contains 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
userWord = (input('Let\'s see if you know what a Palindrome is. Please give me a word you think is a Palindrome.\n')) | |
anna = [item for item in userWord] | |
while anna != anna[::-1]: | |
print(userWord + ' is not a Palindrome.') | |
userWord = input() | |
anna = [item for item in userWord] | |
print(userWord + ' is a Palindrome!') |
This file contains 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
a = [1, 4, 9, 16, 25, 36, 49, 64, 81, 100] | |
evenList = [n for n in a if n%2 == 0] | |
print (evenList) |
This file contains 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
# This code plays a game of rock paper scissors | |
import random | |
# Creates the computers choice | |
def roshambo(randomChoice): | |
if randomChoice == 1: | |
return 'scissors' | |
elif randomChoice == 2: | |
return 'rock' |
This file contains 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
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) | |
This file contains 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
#include<stdio.h> | |
void townCountry(); | |
void gasCalc(); | |
void gasPrice(); | |
char live; | |
float cityReg = 1.254; | |
float cityHO = 1.309; |
OlderNewer