en
Feedback
Cᴏᴅᴇs Sɴɪᴘᴘᴇᴛs

Cᴏᴅᴇs Sɴɪᴘᴘᴇᴛs

Open in Telegram

👩‍💻 Wᴇʟᴄᴏᴍᴇ ᴛᴏ @CodesSnippet! 🚀 Jᴏɪɴ ᴜs ғᴏʀ ᴅᴀɪʟʏ sɴɪᴘᴘᴇᴛs ᴏғ ᴄᴏᴅɪɴɢ 🧩 ᴋɴᴏᴡʟᴇᴅɢᴇ! 💻💡 Hᴇʀᴇ, ʏᴏᴜ'ʟʟ ғɪɴᴅ 👀 ʙɪᴛᴇ-sɪᴢᴇᴅ ᴘɪᴇᴄᴇs ᴏғ ᴄᴏᴅᴇ, 🔥 ᴘʀᴏɢʀᴀᴍᴍɪɴɢ ᴛɪᴘs, ᴀɴᴅ ᴛʀɪᴄᴋs ᴛᴏ ʟᴇᴠᴇʟ ᴜᴘ ʏᴏᴜʀ ᴄᴏᴅɪɴɢ sᴋɪʟʟs! 💪💻 Sᴛᴀʏ ᴜᴘᴅᴀᴛᴇᴅ ᴏɴ ᴛʜᴇ ʟᴀᴛᴇsᴛ ᴛʀᴇɴᴅs ɪɴ ᴛᴇᴄʜ

Show more
The country is not specifiedTechnologies & Applications51 481
305
Subscribers
No data24 hours
-67 days
-630 days
Posts Archive
Scrap Leetcode information using Mukesh-Api
import cloudscraper

def fetch_leetcode_information(query=""):
    """
    Fetches leetcode information from a given API based on the query parameter.

    Args:
    query (str): The query to filter the results, defaults to an empty string.

    Returns:
    dict: Key-value pairs extracted from the fetched JSON data.
    """
    base_url = "https://mukesh-api.vercel.app/leetcode"
    if query:
        url = f"{base_url}?query={query}"
    else:
        query = input("Please enter a query: ")
        url = f"{base_url}?query={query}"

    scraper = cloudscraper.create_scraper()
    response = scraper.get(url).json()
    return response.get("results", {})


# example 
query = "noob-mukesh"
data = fetch_leetcode_information(query)

for key, value in data.items():
    print(f"{key}: {value}")
#CodeSnippet Language: Python Jᴏɪɴ ᴜs :- @CodesSnippet

Just Programmer things😗
Just Programmer things😗

print(r"\npython") #What is the output? Explain Why?
Anonymous voting

What is ( True + True ) ? and Why?

:= which of the following is true about this operator
Anonymous voting

Correct answer will be?
Anonymous voting

Guess the output ?
string = "Lorem ipsum dolor sit amet"
words = string.split(" ")
word_counts = {}

for word in words:
    word = word.lower()
    word_counts[word] = word_counts.get(word, 0) + 1

print(word_counts)

Scrap Image from bing using BeautifulSoup import requests from bs4 import BeautifulSoup as BSP def split_url(url): return url
Scrap Image from bing using BeautifulSoup
import requests
from bs4 import BeautifulSoup as BSP

def split_url(url):
    return url.split('&')[0]

def get_image_urls(search_query):
    url = f"https://cn.bing.com/images/search?q={search_query}&first=1&cw=1177&ch=678"
    headers = {
        "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3"
    }
    rss = requests.get(url, headers=headers)
    soup = BSP(rss.content, "html.parser")

    all_img = []
    for img in soup.find_all('img'):
        img_url = img.get('src2')
        if img_url and img_url.startswith('https://tse2.mm.bing.net/'):
            img_url = split_url(img_url)
            all_img.append(img_url)

    return all_img

print(get_image_urls("cat"))
sample response :
['https://tse2.mm.bing.net/th?q=Cat+Portrait', ...']
#CodeSnippet #ProgrammingFun Language: Python Jᴏɪɴ ᴜs :- @CodesSnippet

Which language is considered as fastest Programming language ??
Anonymous voting

Python is a
Anonymous voting

Free Platforms to Learn Coding in 2024🔎 HTML - https://html.com CSS - https://web.dev/learn/css JavaScript - https://javascript.info Python - https://learnpython.org Jᴏɪɴ ᴜs :- @CodesSnippet

Search hd image from unsplash using mukesh api
import requests

ask = input("query to search image:-  ")

class Unsplash:
    base_url = "https://mukesh-api.vercel.app/"
    """search image from unsplash api by @mr_sukkun"""

    def __init__(self, ask) -> None:
        self.ask = ask

    def unsplash_reply(self):
        url = f"{self.base_url}unsplash?query={self.ask}"
        response = requests.get(url)
        if response.status_code == 200:
            return response.json()
        else:
            return {"error": "Failed to fetch data"}

x = Unsplash(ask)
print(x.unsplash_reply())
#CodeSnippet Language: Python Jᴏɪɴ ᴜs :- @CodesSnippet

Scrap Image from google using BeautifulSoup
import requests
from bs4 import BeautifulSoup as BSP

def get_image_urls(search_query):
    url = f"https://www.google.com/search?q={search_query}&tbm=isch"
    headers = {
        "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3"
    }
    rss = requests.get(url, headers=headers)
    soup = BSP(rss.content, "html.parser")

    all_img = []
    for img in soup.find_all('img'):
        src = img['src']
        if not src.endswith("gif"):
            all_img.append(src)

    return all_img

print(get_image_urls("boy"))
#CodeSnippet #ProgrammingFun Language: Python Jᴏɪɴ ᴜs :- @CodesSnippet

// Checking input is palindrome or not 
// Example: 121 is palindrome number

function isPalindrome(num) {
  const original = num;
  let reminder = 0;
  while(num != 0) {
    let lastDig = num % 10;
    reminder = (reminder * 10) + lastDig;
    num = Math.floor(num / 10);
  }
  return original === reminder;
};

const userInput = parseInt(prompt("Enter a number: "));

if(isPalindrome(userInput)) {
  console.log(`${userInput} is Palindrome.`);
} else {
  console.log(`${userInput} is not Palindrome.`)
}
Approx Time: 0.240966796875 ms Language: JavaScript

# Morse Code Encrypter/Decrypter Using Python

from decrypto import MorseCodeCipher

choic = """
Enter your desire option...
1. Encrypt Your Text!
2. Decrypt Your Text!
Enter Only 1 or 2...
>> """
choose = input(choic)   # Taking input from user

if choose == '1':
    txt = input("Enter Your Text: \n")
    encrypt = MorseCodeCipher().encrypt(txt)
    print("\nYour Morse Code is 👇🏻\n", encrypt)
elif choose == '2':
    txt = input("Enter Your MorseCode: \n")
    decrypt = MorseCodeCipher().decrypt(txt)
    print("\nYour Decrypted Text is 👇🏻\n", decrypt)
else:
    print("\nShit what you doing ugly guy??")
    exit(0)
- Before you run this code
import decrypto

Pattern Challenge.. # Hollow Rectangle of '*' def hollow_pattern(row, col): for i in range(row): for j in range(col): if i ==
Pattern Challenge..
# Hollow Rectangle of '*'
def hollow_pattern(row, col):
    for i in range(row):
        for j in range(col):
            if i == 0 or i == row-1 or j == 0 or j == col-1:
                print('* ', end='')
            else:
                print('  ', end='')
        print('')
>> Approx Time: 6.67ms Jᴏɪɴ ᴜs :- @CodesSnippet

Simple website using python #flask from flask import Flask app = Flask(__name__) @app.route('/') def hello_world(): return 'W
Simple website using python #flask
from flask import Flask
app = Flask(__name__)

@app.route('/')
def hello_world():
    return 'Welcome to Code Snippets'

if __name__ == "__main__":
    app.run()
pip install flask #CodeSnippet #ProgrammingFun

👩‍💻 Welcome to @CodesSnippet! 🔫 Join us for daily snippets of coding👩‍💻 knowledge! 💻 Here, you'll find 👀 bite-sized pieces of code, programming tips, and tricks to level up your coding skills! 💻 Stay updated on the latest trends in the tech world and engage with fellow coders 💗 in our vibrant community! 🌐💬 Let's crack the coding 👩‍💻 together and bring your projects to life! ⭐️👨‍💻 Lang : Python , Java, Javascript, c++ and many more. #CodeSnippet #ProgrammingFun Jᴏɪɴ ᴜs :- @CodesSnippet