This file contains hidden or 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
print("\n___________Welcome to List Overlap Comprehensions Solutions #Exercise 10 ___________") | |
import random | |
a = [random.randrange(1, 10) for _ in range(0, random.randint(1,20))] | |
b = [random.randrange(1, 10) for _ in range(0, random.randint(1,20))] | |
c = [] | |
c = [a[i] for i in range(0, len(a)) if (a[i] not in c and a[i] in b)] | |
print(a) | |
print(b) |
This file contains hidden or 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
# Generate a random number between 1 and 9 (including 1 and 9). Ask the user to guess the number, then tell them whether they guessed too low, too high, or exactly right. (Hint: remember to use the user input lessons from the very first exercise) | |
# # Extras: | |
# | |
# Keep the game going until the user types “exit” | |
# Keep track of how many guesses the user has taken, and when the game ends, print this out. | |
# In[209]: | |
This file contains hidden or 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] | |
print([x for x in a if x % 2 == 0]) |
This file contains hidden or 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
print("\n___________Welcome to palindrome word Finder___________") | |
word = input("Enter the word :") | |
x = word | |
y = word[::-1] | |
if x == y: | |
print("This is an palindrome !") | |
else: |
This file contains hidden or 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 extract_features(iDirName, cnn_model): | |
# get face detector from dlib and initialize the face aligner | |
detector = dlib.get_frontal_face_detector() | |
# open the video file | |
iFramePaths = [os.path.join(iDirName, iFramePath) for iFramePath in os.listdir(iDirName)] | |
# an empty list to hold the results | |
features = [] | |
# process each frame |
This file contains hidden or 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=a = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89] | |
b=b = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13] | |
c=[] | |
for item in a: | |
if item in b: | |
if item not in c: | |
c.append(item) | |
print (c) |
This file contains hidden or 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
print("\n___________Welcome to Divisor Finder___________") | |
__author__ = 'jeffreyhunt' | |
num = int(input("Please choose a number to divide: ")) | |
listRange = list(range(1,num+1)) | |
divisorList = [] |
This file contains hidden or 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] | |
print([x for x in a if x < 10]) | |
This file contains hidden or 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
num = int(input('Enter a number:')) | |
if num % 2==0: | |
print('The number you enter is even! ') | |
else: | |
print('the number you enter is Odd') |