<jupyter_start><jupyter_text>More String Methods<jupyter_code>print("Mountains".upper())
print("Mountains".lower())
answer = "YES"
if answer.lower() == "yes":
    print("User said yes")
print("  yes  ".strip())
print("  yes  ".lstrip())
print("  yes  ".rstrip())
print("The number of times e occurs in this string in 4".count("e"))
print("Forest".endswith("rest"))
print("Forest".isnumeric())
print("12345".isnumeric())
print(int("12345"))
print(" ".join(["This", "is", "a", "phrasee", "joined", "by", "spaces"]))
print("...".join(["This", "is", "a", "phrase", "joinded", "by", "triple", "dots"]))
print("This is another example".split())<jupyter_output>['This', 'is', 'another', 'example']<jupyter_text>Formatting Strings<jupyter_code>name = "Manny"
number = len(name) * 3
"Hello {}, your lucky number is {}".format(name, number)
"Your lucky number is {number}, {name}".format(name=name, number=len(name)*3)
price = 7.5
with_tax = price * 1.09
print(price, with_tax)
print("Base price: ${:.2f} with Tax: ${:.2f}".format(price, with_tax))
def to_celsius(x):
    return (x-32) * 5/9

for x in range(0, 101, 10):
    print("{:>3} F | {:>6.2f} C".format(x, to_celsius(x)))
print("'{:d}'".format(10))
print("'{:.2f}'".format(0.5))
print("'{:.2s}'".format('Python')) 
print("'{:<6s}'".format('Py'))
print("'{:>6s}'".format('Py'))
print("'{:^6s}'".format('Py'))<jupyter_output>'10'
'0.50'
'Py'
'Py    '
'    Py'
'  Py  '<jupyter_text>Official documentation for [the format string syntax](https://docs.python.org/3/library/string.htmlformatstrings)Check out the official documentation for [all available expressions](https://docs.python.org/3/library/string.htmlformat-specification-mini-language).<jupyter_code>name = "Mircah"
print(f"Hello {name}")
item = "Purple Cup"
amount = 5
price = amount * 3.25
print(f"Item: {item} - Amount: {amount} - Price: {price:.2f}")<jupyter_output>Hello Mircah
Item: Purple Cup - Amount: 5 - Price: 16.25
StarcoderdataJupyterStructuredCleanDedup