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
| from redis import Redis | |
| from rq.job import Job | |
| redis = Redis() | |
| job = Job.fetch('my_job_id', connection=redis) | |
| print(f'Result: {job.result}') |
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 nth_prime_number(n): | |
| primes = 1 | |
| num = 2 | |
| while primes <= n: | |
| mod = 1 | |
| ptrue = True | |
| while mod < (num - 1): | |
| if num%(num-mod) == 0: | |
| ptrue = False | |
| break |
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
| from redis import Redis | |
| from rq import Queue | |
| cnx = Redis() | |
| task_queue = Queue("long_task_queue", connection=cnx) |
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 turtle as ๐ข | |
| for _ in range(4): | |
| ๐ข.forward(100) | |
| ๐ข.left(90) |
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
| from PIL import Image as ๐ผ๏ธ | |
| ๐ฆ = ๐ผ๏ธ.open("mountains.jpg") | |
| ๐ฆ.show() |
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 pandas as __pythonji_panda__ | |
| # Define a dataframe and print it to the console | |
| __pythonji_snake__ = __pythonji_panda__.DataFrame( | |
| { | |
| "animal": ["Panda", "Python", "Lion"], | |
| "__pythonji_grinning_face__": ["__pythonji_panda__", "__pythonji_snake__", "__pythonji_lion__"], | |
| "number": [1, 2, 3], | |
| }, | |
| ).set_index("__pythonji_grinning_face__") |
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 pandas as ๐ผ | |
| # Define a dataframe and print it to the console | |
| ๐ = ๐ผ.DataFrame( | |
| { | |
| "animal": ["Panda", "Python", "Lion"], | |
| "๐": ["๐ผ", "๐", "๐ฆ"], | |
| "number": [1, 2, 3], | |
| }, | |
| ).set_index("๐") |
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 os as ๐ฅ๏ธ | |
| import sys as ๐ ๏ธ | |
| from PIL import Image as ๐ผ๏ธ | |
| for ๐ฅ in ๐ ๏ธ.argv[2:]: | |
| f, e = ๐ฅ๏ธ.path.splitext(๐ฅ) | |
| ๐ค = f + ".jpg" | |
| if ๐ฅ != ๐ค: | |
| try: | |
| with ๐ผ๏ธ.open(๐ฅ) as ๐ฆ: |
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 add(x: int, y: int) -> int: | |
| return x + y |
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
| number: str = "1" | |
| number = 2 | |
| number += 1 | |
| print(number) # prints 3 | |
| sequence: list = ["foo", "bar"] | |
| sequence = set() | |
| print(type(sequence)) # prints <class 'set'> |
NewerOlder