Python Codes Basic to Advance
Ir al canal en Telegram
Python Codes Basic to Advance All Codes @C_Codes_pro @CPP_Codes_pro @Java_Codes_Pro @nodejs_codes_pro Discussion @bca_mca_btech
Mostrar más2 813
Suscriptores
Sin datos24 horas
-47 días
-2430 días
Archivo de publicaciones
# Triangle pattern 🔺️
n = 6
for i in range(n):
print(" " * (n - 1 - i), end="")
print("* " * (i + 1))
# @python_codes_pro
# 15. str.isnumeric():
numeric_string = "12345"
is_numeric = numeric_string.isnumeric()
print(is_numeric)
# @python_codes_pro
/py # 15. str.isnumeric():
numeric_string = "12345"
is_numeric = numeric_string.isnumeric()
print(is_numeric)
# @python_codes_pro
# 14. str.isalpha():
alphabetic_string = "Hello"
is_alpha = alphabetic_string.isalpha()
print(is_alpha)
# @python_codes_pro
/py # 14. str.isalpha():
alphabetic_string = "Hello"
is_alpha = alphabetic_string.isalpha()
print(is_alpha)
# @python_codes_pro
# 13. str.isdigit():
numeric_string = "12345"
is_digit = numeric_string.isdigit()
print(is_digit)
# @python_codes_pro
/py # 13. str.isdigit():
numeric_string = "12345"
is_digit = numeric_string.isdigit()
print(is_digit)
# @python_codes_pro
# 12. str.join(iterable):
words = ['Hello', 'World']
my_string = ' '.join(words)
print(my_string)
# @python_codes_pro
/py # 12. str.join(iterable):
words = ['Hello', 'World']
my_string = ' '.join(words)
print(my_string)
# @python_codes_pro
# 11. str.split(sep=" "):
my_string = "Hello, World!"
words = my_string.split()
print(words)
# @python_codes_pro
/py # 11. str.split(sep=" "):
my_string = "Hello, World!"
words = my_string.split()
print(words)
# @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
/py # 10. str.replace(old, new):
my_string = "Hello, World!"
new_string = my_string.replace("Hello", "Hi")
print(new_string)
# @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
/py # 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
# 8. str.endswith(suffix):
my_string = "Hello, World!"
ends_with_world = my_string.endswith("World!")
print(ends_with_world)
# @python_codes_pro
/py # 8. str.endswith(suffix):
my_string = "Hello, World!"
ends_with_world = my_string.endswith("World!")
print(ends_with_world)
# @python_codes_pro
# 7. str.startswith(prefix):
my_string = "Hello, World!"
starts_with_hello = my_string.startswith("Hello")
print(starts_with_hello)
# @python_codes_pro
