-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathday9.py
More file actions
25 lines (24 loc) · 948 Bytes
/
day9.py
File metadata and controls
25 lines (24 loc) · 948 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#week 2 ___ day9
#learn how can we use format() method to combine strings and numbers
# للدمج بين النصوص والارقام فإننا نستخدم دالة format
age = 34
txt= "my name is muteb, and i have{}"
print(txt.format(age))
###########################################
# يمكن تمرير عدد غير محدود من argument وذلك لوضعها في مكان {}
quantity=3
itemno=567
price=49.50
myorder="i want {} pieces of item {} for {} dollars"
print(myorder.format(quantity,itemno,price))
######################################################
first= "muteb" ; last= "alotaibi"
full=f"{first} {last}"
print(full)
############################################
# تمرير الشقلعةثىفس للدالة باستخدام رقم الخانة في المصفوفة
quantity=3
itemno=567
price=49.50
myorder="i want to pay {2} dollars for {0} pices of {1} items"
print(myorder.format(quantity,itemno,price))