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 proteins(strand: str) -> list: | |
prot = [] | |
if len(strand) % 3 == 0: | |
strands = [strand[i:i + 3] for i in range(0, len(strand), 3)] | |
for single_strand in strands: | |
if "AUG" in single_strand: | |
prot.append("Methionine") | |
if "UUU" in single_strand: | |
prot.append("Phenylalanine") | |
if "UUC" in single_strand: |
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
/** | |
* LeapExample | |
* | |
* A leap year (in the Gregorian calendar) occurs: | |
* In every year that is evenly divisible by 4. | |
* Unless the year is evenly divisible by 100, in which case it's only a leap year if the year is also evenly divisible by 400. | |
* Some examples: | |
* 1997 was not a leap year as it's not divisible by 4. | |
* 1900 was not a leap year as it's not divisible by 400. | |
* 2000 was a leap year! |
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("Generation Identifier") | |
print("-"*40) | |
print("\n") | |
birth_year = int(input("Which year were you born ? ")) | |
if birth_year >= 1883 and birth_year <= 1900: | |
print("Lost Generation.") | |
elif birth_year >= 1901 and birth_year <= 1927: | |
print("Greatest Generation.") | |
elif birth_year >= 1928 and birth_year <= 1946: |
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
horas = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23] | |
minutos = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, | |
30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, | |
57, 58, 59] | |
for h in horas: | |
for m in minutos: | |
temp_string_h = str("{:02d}".format(h)) | |
temp_string_m = str("{:02d}".format(m)) | |
if (temp_string_h[0]== temp_string_m[1] and temp_string_h[1]== temp_string_m[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
CountVowels = str(input("Escribe una frase o texto: ")) | |
d_vowels = {"a": 0, "e": 0, "i": 0, "o": 0, "u": 0} | |
for letter in CountVowels: | |
if "a" in letter.lower(): | |
d_vowels["a"] = d_vowels["a"] + 1 | |
if "e" in letter.lower(): | |
d_vowels["e"] = d_vowels["e"] + 1 | |
if "i" in letter.lower(): |
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
import re | |
def palindrome_test(phrase): | |
cleanString = re.sub('\W+', '', phrase.lower()) | |
return cleanString == cleanString[::-1] | |
while True: | |
user_entry = input("Enter string to test for palindrome or 'exit' : ") | |
if user_entry.lower() == 'exit': |