Skip to content

Instantly share code, notes, and snippets.

@raeq
Created April 30, 2020 16:04
Show Gist options
  • Save raeq/a3fa2cea2fb5e60af4aa6c25472bcdde to your computer and use it in GitHub Desktop.
Save raeq/a3fa2cea2fb5e60af4aa6c25472bcdde to your computer and use it in GitHub Desktop.
#Let's define a string to begin with.
sentence = "The quick brown fox jumped over the lazy dog."
#let's show the string with all characters in lower case
print(f"Lower case representation:\n{ sentence.lower() }")
#let's show the string with all characters in title case
print(f"Title case representation:\n{ sentence.title() }")
#let's show the string centered with 80 chracters
print(f"Center :\n{ sentence.center(80) }")
#let's count how many times the letter e occurs in the string
print(f"Count of the character e:\n{ sentence.count('e') } ")
#let's count how many characters in total the string has.
print(f"Count of any character:\n{ sentence.count('') } ")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment