Python में डेटा टाइप्स
Jason Myers
Instructor
f""cookie_name = "Anzac"
cookie_price = "$1.99"
print(f"Each { cookie_name } cookie costs { cookie_price }.")
"Each Anzac cookie costs $1.99."
"".join() जिस string पर कॉल होता है, उसी से किसी iterable को जोड़ा जाता हैchild_ages = ["3", "4", "7", "8"]
print(", ".join(child_ages))
"3, 4, 7, 8"
print(f"The children are ages {','.join(child_ages[0:3])}, and {child_ages[-1]}.")
"The children are ages 3, 4, 7, and 8."
.startswith() और .endswith() बताएँगे कि कोई string किसी अक्षर या दूसरी string से शुरू/समाप्त होती है या नहींboy_names = ["Mohamed", "Youssef", "Ahmed"]
print([name for name in boy_names if name.startswith('A')])
["Ahmed"]
in ऑपरेटर किसी iterable जैसे string में मान को ढूँढता है."long" in "Life is a long lesson in humility."
True
"life" in "Life is a long lesson in humility."
False
.lower() method लोअर-केस string लौटाता है"life" in "Life is a long lesson in humility.".lower()
True
Python में डेटा टाइप्स