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 @@
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] )
10 changes: 10 additions & 0 deletions solution.py
Original file line number Diff line number Diff line change
@@ -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)