• Jun 1, 2023 •CodeCatch
0 likes • 2 views
def calculate_values(): value1 = 10 value2 = 20 return value1, value2 result1, result2 = calculate_values() print("Result 1:", result1) print("Result 2:", result2)
• Aug 12, 2024 •AustinLeath
0 likes • 5 views
magnitude = lambda bits: 1_000_000_000_000_000_000 % (2 ** bits) sign = lambda bits: -1 ** (1_000_000_000_000_000_000 // (2 ** bits)) print("64 bit sum:", magnitude(64) * sign(64)) print("32 bit sum:", magnitude(32) * sign(32)) print("16 bit sum:", magnitude(16) * sign(16))
• Jan 23, 2021 •asnark
0 likes • 0 views
""" Take screenshots at x interval - make a movie of doings on a computer. """ import time from datetime import datetime import ffmpeg import pyautogui while True: epoch_time = int(time.time()) today = datetime.now().strftime("%Y_%m_%d") filename = str(epoch_time) + ".png" print("taking screenshot: {0}".format(filename)) myScreenshot = pyautogui.screenshot() myScreenshot.save(today + "/" + filename) time.sleep(5) # # and then tie it together with: https://github.com/kkroening/ffmpeg-python/blob/master/examples/README.md#assemble-video-from-sequence-of-frames # """ import ffmpeg ( ffmpeg .input('./2021_01_22/*.png', pattern_type='glob', framerate=25) .filter('deflicker', mode='pm', size=10) .filter('scale', size='hd1080', force_original_aspect_ratio='increase') .output('movie.mp4', crf=20, preset='slower', movflags='faststart', pix_fmt='yuv420p') .run() ) """
• May 31, 2023 •CodeCatch
# Function to check Armstrong number def is_armstrong_number(number): # Convert number to string to iterate over its digits num_str = str(number) # Calculate the sum of the cubes of each digit digit_sum = sum(int(digit) ** len(num_str) for digit in num_str) # Compare the sum with the original number if digit_sum == number: return True else: return False # Prompt user for a number number = int(input("Enter a number: ")) # Check if the number is an Armstrong number if is_armstrong_number(number): print(number, "is an Armstrong number.") else: print(number, "is not an Armstrong number.")
• Apr 21, 2023 •sebastianagauyao2002-61a8
print("hellur")
• Nov 18, 2022 •AustinLeath
0 likes • 1 view
# importing the modules import os import shutil # getting the current working directory src_dir = os.getcwd() # printing current directory print(src_dir) # copying the files shutil.copyfile('test.txt', 'test.txt.copy2') #copy src to dst # printing the list of new files print(os.listdir())