From 006f00e5e93814a69f5256c3e571ddf361e215b1 Mon Sep 17 00:00:00 2001 From: sharifah Date: Tue, 17 Feb 2026 23:33:01 +0300 Subject: [PATCH] solved arthmetic and string lab tasks --- StringLab.py | 11 +++++++++++ main.py | 13 +++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 StringLab.py create mode 100644 main.py diff --git a/StringLab.py b/StringLab.py new file mode 100644 index 0000000..d5b3fbc --- /dev/null +++ b/StringLab.py @@ -0,0 +1,11 @@ +sentence = "Artificial Intelligence is an evolution that help human achieve their goals" +word = "evolution" +print (f"the lenght of sentence is:{len(sentence)}") +print(f"first occurrence index", sentence.find(word)) +print(f"word counts:{sentence.count(word)}") +print(f"Uppercase:{sentence.upper()}") +print(f"Lowercase:{sentence.lower()}") +new_sentence = sentence.replace(word,"Progress") +print(f"new sentence:{new_sentence}") +print(f"last charecter: {sentence[-1]}") + diff --git a/main.py b/main.py new file mode 100644 index 0000000..8ac6fe5 --- /dev/null +++ b/main.py @@ -0,0 +1,13 @@ +price = 3 +quantity = 4 +tax_rate = 0.020 +subtotal = price*quantity +tax = subtotal*tax_rate +total = subtotal + tax +print(f"Price of item:${price:.2f}") +print(f"quantity:{quantity}") +print(f"Tax rate:{tax_rate*100}%") +print() +print (f"Subtotal: ${subtotal:.2f}") +print (f"Tax: ${tax:.2f}") +print (f"Total: ${total:.2f}")