Skip to main content

Command Palette

Search for a command to run...

Practicing name_cases in Python

Doing beginner level stuff again, but with more practice

Published
3 min read
Practicing name_cases in Python

Good morning! I am back to learning Python using my new Python Crash Course Third Edition book that I purchased from Barnes & Noble. It was my birthday present to myself from last week. I honestly can't remember the last time I went into a bookstore to buy a book, as I usually just use Amazon, but I couldn't wait to get my hands on it. Ah, how nice it feels to grab my book and start skimming. I'm still quite sick, even took a day off from work to recuperate a bit more before heading back to my laborious job. But that doesn't stop me from coding.

Anyways, here is what I have practiced today. I have done this before, doing online tutorials, but the book has me practicing more which I enjoy. I get to show you the things I am interested in, mainly the podcasts of the inventors of some programming languages and some hockey legends you may have heard of.

# 2-3

name = "Eric"
print("Hello", name, ", would you like to learn Python today?")

# 2-4 Use a variable to represent a person's name and then print name in lowercas, uppcase, and title case.

print(name.lower())
print(name.upper())
print(name.title())

#2-5 Find a quote. Print Quote and name of author. 

quote = '''"You miss 100% of the shots you don't take."'''
author = "Wayne Gretzky"
print(author, "once said, ", quote)

#2-6 Quote 2
famous_person = "Wayne Gretzky"
message = "once said," """ "You miss 100% of the shots you don't take." """
print(famous_person, message)

famous_person2 = "Jim McKenny"
message2 = "once said," """ "Half the game is mental; the other half is being mental." """
print(famous_person2, message2)

famous_person3 = "Guido Van Rossum"
message3 = "once said," """ "Python is an experiment in how much freedom programmers need. \nToo much freedom and nobody can read another's code; too little and expressiveness is endangered." """
print(famous_person3, message3)

famous_person4 = "Bjarne Stroustrup"
message4 = "once said," """ "There are only two kinds of languages: the ones people complain about \nand the ones nobody uses". """
print(famous_person4, message4)

famous_person5 = "Brendan Eich"
message5 = "once said," """ “When you look at what I did in 10 days, it was like a seed. \nIt was this potent kind of compromise, but still very powerful kernel that grew into a bigger language. \nAnd part of the challenge — and I’ve been working on the standardization ever since I had to restart the standards body… \nI had to help people see how to let the seed unfold into a full language.” """
print(famous_person5, message5)

#2-7 Use a variable for a persons name, including whitespaces. Use \t and \n at least once. then print using strip.
persons_name = " Lex Fridman "
message = "\tHosts the amazing " + persons_name.strip() + " \n\tpodcast!"
print(message)

#2-8 Assign value python_notes.txt to a variable called filename. Then use removesuffix()

filename = "python_notes.txt"
print(filename.removesuffix(".txt"))