fa
Feedback
Python Codes Basic to Advance

Python Codes Basic to Advance

رفتن به کانال در Telegram
2 813
مشترکین
اطلاعاتی وجود ندارد24 ساعت
-47 روز
-2430 روز
آرشیو پست ها
# fetch song link with title url = "https://song.panditsiddharth.repl.co/song?song=ae+watan" import requests as r print(r.get(url).text) # @Python_Codes_Pro

# fetch song lyrics url = "https://song.panditsiddharth.repl.co/lyrics?song=ae+watan" import requests as r print(r.get(url).text)

/py # fetch song lyrics url = "https://song.panditsiddharth.repl.co/lyrics?song=ae+watan" import requests as r print(r.get(url).text)

I will give example of each function tomorrow But for now you want to see work of these functions @python_codes_pro #share #support

String functions 1. len(str): Returns the length of the string. 2. str.lower(): Returns a copy of the string in lowercase. 3. str.upper(): Returns a copy of the string in uppercase. 4. str.capitalize(): Returns a copy of the string with the first character capitalized. 5. str.title(): Returns a copy of the string with the first character of each word capitalized. 6. str.strip(): Returns a copy of the string with leading and trailing whitespace removed. 7. str.startswith(prefix): Returns True if the string starts with the specified prefix; otherwise, returns False. 8. str.endswith(suffix): Returns True if the string ends with the specified suffix; otherwise, returns False. 9. str.format(*args, **kwargs): Formats the string by replacing placeholders with provided values. 10. str.replace(old, new): Returns a copy of the string with all occurrences of old replaced by new. 11. str.split(sep=" "): Splits the string into a list of substrings based on the specified separator sep (default is space). 12. str.join(iterable): Concatenates elements of the iterable sequence into a single string using str as the separator. 13. str.isdigit(): Returns True if all characters in the string are digits; otherwise, returns False. 14. str.isalpha(): Returns True if all characters in the string are alphabetic; otherwise, returns False. 15. str.isnumeric(): Returns True if all characters in the string are numeric; otherwise, returns False. @python_codes_pro

# fetching lyrics import requests url = 'https://song.panditsiddharth.repl.co/lyrics?song=har+har+shambhu' lyrics = requests.get(url).text print(lyrics)

/py # fetching lyrics import requests url = 'https://song.panditsiddharth.repl.co/lyrics?song=har+har+shambhu' lyrics = requests.get(url).text print(lyrics)

# use of requests module to fetch anything import requests url = 'https://song.panditsiddharth.repl.co/lyrics?song=har+har+shambhu' lyrics = requests.get(url) print(lyrics)

/py # use of requests module to fetch anything import requests url = 'https://song.panditsiddharth.repl.co/lyrics?song=har+har+shambhu' lyrics = requests.get(url) print(lyrics)

# use of requests module to fetch anything import requests url = "https://api.chucknorris.io/jokes/random" response = requests.get(url) data = response.json() joke = data["value"] print(joke)

/py # use of requests module to fetch anything import requests url = "https://api.chucknorris.io/jokes/random" response = requests.get(url) data = response.json() joke = data["value"] print(joke)

Running codes by buttons feature Powered by @IOChannel_bot See more about this bot in @LogicBots channel

# taking numbers in Python num1 = input("Enter first number: ") num2 = input("Enter second number: ") # typecasting string to number num1 = int(num1) num2 = int(num2) print("Sum of numbers is", num1 + num2) # @Python_Codes_pro

/py # taking numbers in Python num1 = input("Enter first number: ") num2 = input("Enter second number: ") # typecasting string to number num1 = int(num1) num2 = int(num2) print("Sum of numbers is", num1 + num2) # @Python_Codes_pro

# taking inputs in Python name = input("Enter your name: ") print("Your name is", name) # @Python_Codes_pro

/py # taking inputs in Python name = input("Enter your name: ") print("Your name is", name) # @Python_Codes_pro

# taking inputs in Python name = input("Enter your name: ") print("Your name is", name) # @Python_Codes_pro

Comment here if any question

def multiply(a): def inner(b): return a * b return inner # Curried function can be used with partial application multiply_by_two = multiply(2) print(multiply_by_two(4)) # Output: 8 # Or it can be invoked with all arguments at once print(multiply(3)(5))

/py def multiply(a): def inner(b): return a * b return inner # Curried function can be used with partial application multiply_by_two = multiply(2) print(multiply_by_two(4)) # Output: 8 # Or it can be invoked with all arguments at once print(multiply(3)(5))