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
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
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> | |
#include<cs50.h> | |
int main (void) | |
{ | |
int hgt = 0;// Initialize variable | |
int i, y; | |
do |
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> | |
int reverseDigits(int userNumber); | |
void sumOriginalReverse(void); | |
int userNumber; | |
int main(void) | |
{ | |
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> | |
#include<math.h> | |
#include<cs50.h> // only for CS50 IDE | |
int main (void) | |
{ | |
float change, rnd; | |
int quarters, dimes, nickles, pennies, coins; | |
OlderNewer