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 yt_dlp | |
def download_video_audio(url): | |
ydl_opts = { | |
'format': 'bestaudio/best', | |
'postprocessors': [{ | |
'key': 'FFmpegExtractAudio', | |
'preferredcodec': 'mp3', | |
'preferredquality': '192', | |
}], |
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 x(number): | |
fibonacci = [1, 1] | |
for _ in range(number-2): | |
last = len(fibonacci) - 1 | |
penultimo = len(fibonacci) - 2 | |
resultado = int(fibonacci[last]) + int(fibonacci[penultimo]) | |
fibonacci.append(resultado) | |
return fibonacci |
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 first_and_last(): | |
a, *b, c = [5, 10, 15, 20, 25] | |
return print(a, "and ", c) | |
first_and_last() |
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 prime_or_not(number): | |
z = 0 | |
for x in range(number): | |
x += 1 | |
if number % x == 0: | |
z += 1 | |
return z |
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 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13] | |
c = list({x for x in a if x in b}) | |
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
import random | |
a = random.randint(1, 9) | |
x = "" | |
while x != "exit": | |
user_number = int(input("Choose a number between 1 and 9:")) | |
if a > user_number: | |
print("Too low!") |
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
x = "1" | |
while x == "1": | |
player1 = input("Player 1, Choose Rock, Scissors or Paper:") | |
player2 = input("Player 2, Choose Rock, Scissors or Paper:") | |
if player1 == player2: | |
print("Draw!") |
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
even = [x for x in [1, 4, 9, 16, 25, 36, 49, 64, 81, 100] if x % 2 == 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
a = input("Say something:") | |
number = int(len(a)) | |
for x in range(number): | |
if a[x] == a[-(x + 1)]: | |
continue | |
else: | |
print("Isn't a palindrome") | |
break |
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 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13] | |
c = [] | |
for x in a: | |
if x in b: | |
if x in c: | |
continue | |
c.append(x) | |
print(c) |
NewerOlder