From 2dd9d02eb3b8768ef84a782cb92acd615696d817 Mon Sep 17 00:00:00 2001 From: Mohammed Alqadda Date: Tue, 17 Feb 2026 15:16:42 +0300 Subject: [PATCH 1/2] partial work done --- lab1.py | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 lab1.py diff --git a/lab1.py b/lab1.py new file mode 100644 index 0000000..c039ea4 --- /dev/null +++ b/lab1.py @@ -0,0 +1,7 @@ +price = 2.99 +quantity = 3 +tax_rate = 7.5 + +subtotal = price * quantity +tax = subtotal * (tax_rate / 100) +total = subtotal + tax From c967df5fd5364459f759f5cbc7d68aa646f934c1 Mon Sep 17 00:00:00 2001 From: Mohammed Alqadda Date: Tue, 17 Feb 2026 15:54:22 +0300 Subject: [PATCH 2/2] Finished the lab + bonus --- bonus.py | 12 ++++++++++++ lab1.py | 4 ++++ 2 files changed, 16 insertions(+) create mode 100644 bonus.py diff --git a/bonus.py b/bonus.py new file mode 100644 index 0000000..513c299 --- /dev/null +++ b/bonus.py @@ -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]) \ No newline at end of file diff --git a/lab1.py b/lab1.py index c039ea4..8468be6 100644 --- a/lab1.py +++ b/lab1.py @@ -5,3 +5,7 @@ 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)) \ No newline at end of file