Python Codes Basic to Advance
2.66K subscribers
82 photos
5 videos
8 files
100 links
Python Codes Basic to Advance

All Codes
@C_Codes_pro
@CPP_Codes_pro
@Java_Codes_Pro
@nodejs_codes_pro

Discussion
@bca_mca_btech
Download Telegram
# fetch song lyrics
url = "https://song.panditsiddharth.repl.co/lyrics?song=ae+watan"

import requests as r
print(r.get(url).text)

# @Python_Codes_Pro
# fetch song link with title
song = "ae watan"
url = "https://song.panditsiddharth.repl.co/song?song=" + song

import requests as r
print(r.get(url).text)

# @Python_Codes_Pro
print("Happy Independence day🇮🇳")
# Run and see its output

message = chr(32) + chr(72) + chr(97) + chr(112) + chr(112) + chr(121) + chr(32) + chr(73) + chr(110) + chr(100) + chr(101) + chr(112) + chr(101) + chr(110) + chr(100) + chr(101) + chr(110) + chr(99) + chr(101) + chr(32) + chr(100) + chr(97) + chr(121) + chr(33)
print('\U0001F1EE\U0001F1F3' + message)
# @python_codes_pro
😁4👍1
# 1. len(str):
my_string = "Hello, World!"
length = len(my_string)
print(length)

# @python_codes_pro
3
# 2. str.lower():
my_string = "Hello, World!"
lowercase_string = my_string.lower()
print(lowercase_string)

# @Python_Codes_Pro
# 3. str.upper():
my_string = "Hello, World!"
uppercase_string = my_string.upper()
print(uppercase_string) 

# @python_codes_pro
# 4. str.capitalize():
my_string = "hello, world!"
capitalized_string = my_string.capitalize()
print(capitalized_string)
# @python_codes_pro
# 5. str.title():
my_string = "hello, world!"
title_case_string = my_string.title()
print(title_case_string)

# @python_codes_pro
1
# 6. str.strip():
my_string = " Hello, World! "
stripped_string = my_string.strip()
print(stripped_string)
# @python_codes_pro
Comment here if any question 👇
1👍1
# 7. str.startswith(prefix):
my_string = "Hello, World!"
starts_with_hello = my_string.startswith("Hello")
print(starts_with_hello)
# @python_codes_pro
╱╱┏╮
╱╱┃┃
▉━╯┗━╮
▉┈┈┈┈┃
▉╮┈┈┈┃
╱╰━━━╯
I hope you like it
👍2
# 8. str.endswith(suffix):
my_string = "Hello, World!"
ends_with_world = my_string.endswith("World!")
print(ends_with_world)
# @python_codes_pro
# 9. str.format(*args, **kwargs):
name = "Alice"
age = 25
formatted_string = "My name is {} and I'm {} years old.".format(name, age)
print(formatted_string)
# @python_codes_pro
# 10. str.replace(old, new):
my_string = "Hello, World!"
new_string = my_string.replace("Hello", "Hi")
print(new_string)
# @python_codes_pro
# 11. str.split(sep=" "):
my_string = "Hello, World!"
words = my_string.split()
print(words)
# @python_codes_pro
# 12. str.join(iterable):
words = ['Hello', 'World']
my_string = ' '.join(words)
print(my_string)
# @python_codes_pro
# 13. str.isdigit():
numeric_string = "12345"
is_digit = numeric_string.isdigit()
print(is_digit)

# @python_codes_pro
# 14. str.isalpha():
alphabetic_string = "Hello"
is_alpha = alphabetic_string.isalpha()
print(is_alpha)
# @python_codes_pro
# 15. str.isnumeric():
numeric_string = "12345"
is_numeric = numeric_string.isnumeric()
print(is_numeric)
# @python_codes_pro