# Manipulating Strings With String Methods

Copied!
Happy Pythoning!

Andres Rengifo

This might be one of the best explanation I have come across about string methods, great!

s150042028

>>> animals = "Animals"
>>> honey = "Honey Bee"
>>> print(animals.lower())
animals
>>> print(honey.lower())
honey bee
>>> print(honey2.lower())

That OK. I can’t insert the images.

Martin Breuss RP Team

@s150042028 that’s great and works to solve the first exercises. Also nice job formatting the code in your comment! :)

s150042028

animals = "Animals"
honey = "Honey Bee"
print(animals.lower())
print(honey.lower())
print(honey2.lower())
print(animals.upper())
print(honey.upper())
print(honey2.upper())
string1 = " Filet Mignon"
string2 = "Brisket "
string3 = " Cheeseburger "
print(string1)
print(string1.lstrip())
print(string2.rstrip())
print(string3.strip())
string11 = "Becomes"
string12 = "becomes"
string13 = "BESR"
string14 = " bEautiful"
print(string11.startswith("be"))
print(string12.startswith("be"))
print(string13.startswith("be"))
print(string14.startswith("be"))
print(string11.lower().startswith("be"))
print(string12.lower().startswith("be"))
print(string13.lower().startswith("be"))
print(string14.lower().lstrip().startswith("be"))

I hope I’m doing well. I don’t know. Please rate my work, if it’s OK. Any suggestions or something wrong as elementary student.

Bartosz Zaczyński RP Team

@s150042028 There’s nothing wrong with your code, which works correctly. You convert strings to lowercase, convert other strings to uppercase, remove whitespace, and correctly check if your strings start with a certain sequence of characters. Overall, this looks like a good start 👍

Mr B

GRRRR. The way I undrestood it was to create a list.. pets= “Animals, “Badger”, “Honey Bee”, “Honey Badger” and seperate the list[....]to print on seperate lines, along with convert to lower, print the lower-list, as seperated lines. then make upper, print upper seperated list.... or am I biting too much off? I cant figure out how to seperate the list??

Mr B

OK, try this.. why.py

pets1 = "Animals"
pets3 = "Honey Bee"

print (pets1.lower() )
print (pets2.lower() )
print (pets3.lower() )
print (pets4.lower() )

print (pets1.upper() )
print (pets2.upper() )
print (pets3.upper() )
print (pets4.upper() )

Mr B

More_why.py

string1 = " Filet Mignon"
string2 = "Brisket "
string3 = " Cheseburger "

string1 = string1.strip()
string2 = string2.strip()
string3 = string3.strip()

print (string1)
print (string2)
print (string3)

And then there is Belogny.py

string1 = "Becomes"
string2 = "becomes"
string3 = "BEAR"
string4 = "bEautiful"
print()

print (string1)
print (string2)
print (string3)
print (string4)
print()

print ("string1 startswith be:", string1.startswith("be") )
print ("string2 startswith be:", string2.startswith("be") )
print ("string3 startswtih be:", string3.startswith("be") )
print ("string4 startswith be:", string4.startswith("be") )
print()

print ('Using .lower() to turn the strings to lowercase')
string1 = string1.lower()
string2 = string2.lower()
string3 = string3.lower()
string4 = string4.lower()
print()

print (string1)
print (string2)
print (string3)
print (string4)
print()

print ("string1 startswith be:", string1.startswith("be") )
print ("string2 startswith be:", string2.startswith("be") )
print ("string3 startswtih be:", string3.startswith("be") )
print ("string4 startswith be:", string4.startswith("be") )
print()

Martin Breuss RP Team

Mr B you tackled the challenge like intended, nice work :)

There’s no need to create a list, you’ll learn about lists later on in the learning path.

I’m also in the process of recording an exercise course that walks you through these review exercises and challenges, so if you want to check back in a bit, then that’ll be available for this course as well.

Mr B

Overachievers, they’re so distracted by semantics. I guess the ‘ADD’ kicked in and overly complicated things.

to join the conversation.