diff --git a/bonus.py b/bonus.py new file mode 100644 index 0000000..c4247cb --- /dev/null +++ b/bonus.py @@ -0,0 +1,12 @@ +the_string = "Python is a great programming language" +the_word = "great" + +#the printing parts +print("The length of the string is",len(the_string)) +print("The index of the word",the_string.find(the_word)) +print("The number of times the word appears in the string is",the_string.count(the_word) ) +print("The string in uppercase is",the_string.upper()) +print("The string in lowercase is",the_string.lower()) + +print("The string with the word'",the_word,"'replaced with 'awesome' is:",the_string.replace(the_word,"awesome") ) +print("the last character in the string is",the_string[-1] ) \ No newline at end of file diff --git a/solution.py b/solution.py new file mode 100644 index 0000000..32dd634 --- /dev/null +++ b/solution.py @@ -0,0 +1,10 @@ +Item_price:int = 12 +tax_rate:float = 0.15 +quantity_item:int = 5 + +subTotal = Item_price * quantity_item +tax_amount = subTotal * tax_rate +total_price = subTotal + tax_amount +print("Item price:","SAR", Item_price, "\nQuantity:", quantity_item, "\nTax rate:", tax_rate * 100, "%") +print("\n======================\n") +print("Subtotal:","SAR", subTotal, "\nTax amount:","SAR", tax_amount, "\nTotal Price:","SAR", total_price)