# 3. str.upper():
my_string = "Hello, World!"
uppercase_string = my_string.upper()
print(uppercase_string)
# @python_codes_pro
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
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
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
my_string = " Hello, World! "
stripped_string = my_string.strip()
print(stripped_string)
# @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
my_string = "Hello, World!"
starts_with_hello = my_string.startswith("Hello")
print(starts_with_hello)
# @python_codes_pro
โฑโฑโโฎ
โฑโฑโโ
โโโฏโโโฎ
โโโโโโ
โโฎโโโโ
โฑโฐโโโโฏ
I hope you like it
โฑโฑโโ
โโโฏโโโฎ
โโโโโโ
โโฎโโโโ
โฑโฐโโโโฏ
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
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
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
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
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
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
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
numeric_string = "12345"
is_numeric = numeric_string.isnumeric()
print(is_numeric)
# @python_codes_pro
โฑโฑโโฎ
โฑโฑโโ
โโโฏโโโฎ
โโโโโโ
โโฎโโโโ
โฑโฐโโโโฏ
I hope you like it
Run any codes in group
@BCA_MCA_BTECH
โฑโฑโโ
โโโฏโโโฎ
โโโโโโ
โโฎโโโโ
โฑโฐโโโโฏ
I hope you like it
Run any codes in group
@BCA_MCA_BTECH
๐2๐ฅฐ2
# Triangle pattern ๐บ๏ธ
n = 6
for i in range(n):
print(" " * (n - 1 - i), end="")
print("* " * (i + 1))
# @python_codes_pro
n = 6
for i in range(n):
print(" " * (n - 1 - i), end="")
print("* " * (i + 1))
# @python_codes_pro
๐1
# Triangle : -
rows = 7
for i in range(1, rows + 1):
for j in range(1, i + 1):
print("*", end=" ")
print()
for i in range(rows - 1, 0, -1):
for j in range(1, i + 1):
print("*", end=" ")
print()
# @python_codes_pro
rows = 7
for i in range(1, rows + 1):
for j in range(1, i + 1):
print("*", end=" ")
print()
for i in range(rows - 1, 0, -1):
for j in range(1, i + 1):
print("*", end=" ")
print()
# @python_codes_pro
20 Questions on python loops:
1. What is a loop in Python?
2. What are the different types of loops in Python?
3. How do you create a for loop in Python?
4. How do you create a while loop in Python?
5. What is the range() function used for in a for loop?
6. How do you access the current iteration number in a for loop?
7. How do you exit a loop early in Python?
8. How do you skip an iteration in a loop?
9. How do you loop over a list in Python?
10. How do you loop over a dictionary in Python?
11. How do you loop over a tuple in Python?
12. How do you loop over a string in Python?
13. How do you loop over a set in Python?
14. How do you loop over a file in Python?
15. How do you loop over multiple lists in Python?
16. How do you loop over the index and value of a list in Python?
17. How do you create an infinite loop in Python?
18. How do you break out of nested loops in Python?
19. How do you use the continue statement in a loop?
20. How do you use the else statement in a loop?
@python_codes_pro
1. What is a loop in Python?
2. What are the different types of loops in Python?
3. How do you create a for loop in Python?
4. How do you create a while loop in Python?
5. What is the range() function used for in a for loop?
6. How do you access the current iteration number in a for loop?
7. How do you exit a loop early in Python?
8. How do you skip an iteration in a loop?
9. How do you loop over a list in Python?
10. How do you loop over a dictionary in Python?
11. How do you loop over a tuple in Python?
12. How do you loop over a string in Python?
13. How do you loop over a set in Python?
14. How do you loop over a file in Python?
15. How do you loop over multiple lists in Python?
16. How do you loop over the index and value of a list in Python?
17. How do you create an infinite loop in Python?
18. How do you break out of nested loops in Python?
19. How do you use the continue statement in a loop?
20. How do you use the else statement in a loop?
@python_codes_pro
โค2๐2
Notes ๐ :
Telegram.me/BCA_Sem1_Notes
Telegram.me/BCA_Sem2_Notes
Telegram.me/BCA_Sem3_Notes
Telegram.me/BCA_Sem4_Notes
Telegram.me/BCA_Sem5_Notes
Telegram.me/BCA_Sem6_Notes
Code practice Channels:
Telegram.me/C_Codes_pro
Telegram.me/CPP_Codes_pro
Telegram.me/Python_Codes_pro
Telegram.me/Java_Codes_Pro
Telegram.me/Nodejs_Codes_Pro
Info channel:
Telegram.me/Btech_bca_mca
Discussion groups:
Telegram.me/bca_mca_btech
Telegram.me/bca_group_ignou
Learn coding:
Youtube.com/IgnouStudyCenter
Telegram.me/BCA_Sem1_Notes
Telegram.me/BCA_Sem2_Notes
Telegram.me/BCA_Sem3_Notes
Telegram.me/BCA_Sem4_Notes
Telegram.me/BCA_Sem5_Notes
Telegram.me/BCA_Sem6_Notes
Code practice Channels:
Telegram.me/C_Codes_pro
Telegram.me/CPP_Codes_pro
Telegram.me/Python_Codes_pro
Telegram.me/Java_Codes_Pro
Telegram.me/Nodejs_Codes_Pro
Info channel:
Telegram.me/Btech_bca_mca
Discussion groups:
Telegram.me/bca_mca_btech
Telegram.me/bca_group_ignou
Learn coding:
Youtube.com/IgnouStudyCenter
๐1
Python Codes Basic to Advance pinned ยซNotes ๐ : Telegram.me/BCA_Sem1_Notes Telegram.me/BCA_Sem2_Notes Telegram.me/BCA_Sem3_Notes Telegram.me/BCA_Sem4_Notes Telegram.me/BCA_Sem5_Notes Telegram.me/BCA_Sem6_Notes Code practice Channels: Telegram.me/C_Codes_pro Telegram.me/CPP_Codes_pro Telegramโฆยป