Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions bonus.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
quote = "I thought I knew who I was, but now I wonder if I ever did."
word = "wonder"
print("Sentence: " + quote)
print("The word:" , word)
print("Length of sentence is" , len(quote))
print("Index of word (" + word + ") in the sentence is in", quote.find(word))
#print(quote[38:45])
print("The number of times the word (" + word + ") appears in the sentence is " , quote.count(word))
print("Sentence in uppercase: " + quote.upper())
print("Sentence in lowercase: " + quote.lower())
print("The word (" + word + ") replaced with (forgot): " + quote.replace(word, "forgot"))
print("Last charecter in the sentence is: " + quote[-1])
11 changes: 11 additions & 0 deletions lab1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
price = 2.99
quantity = 3
tax_rate = 7.5

subtotal = price * quantity
tax = subtotal * (tax_rate / 100)
total = subtotal + tax

print("Price of item: ${:.2f}\nQuantity: {}\nTax rate: {}%".format(price, quantity, tax_rate))
print()
print("Subtotal: ${:.2f}\nTax: ${:.2f}\nTotal: ${:.2f}".format(subtotal, tax, total))