#temp1
total_number = oneTwoThree = 1
print(total_number, oneTwoThree)
x1 = 1
__main__ =1
print (x1, id(x1))
x1 = "hello"
print(x1,id(x1))
def a():
'''hello
abcdabcd'''
pass
help(a)
x = y = total_number = oneTwoThree = 1
print(total_number, oneTwoThree, x, y)
#del x
print(total_number, oneTwoThree, x, y)
x = 1
y = 1.0
z = 1+1j
i = "abc"
j = True
print(type(x), type(y), type(z), type(i), type(j))
print(0.5-0.4)
print(0.1+0.1+0.1)
#temp 2
from decimal import Decimal
print(Decimal("0.5") - Decimal("0.4"))
print(type(0.1))
x = 10**20 # 1 followed by 20 zeros
print(x)
print(type(x)) # Still <class 'int'>
print(("hello".upper().lower().title() * 3).capitalize().isalnum())
#temp 3
name = "john"
age = 10
# case 1 place holder codes %s string, %d integer %f float %x hex
print("Name : %s, Age : %s" % (name, age))
print("Name : %s, Age : %d" % (name, age))
# case 2 convert data to str
print("Name : " + name +", Age : " + str(age))
# case 3 str.format()
print("Name : {}, Age : {}, Name again : {}".format(name, age, name))
# case 4 named arguments
print("Name : {n}, Age : {a}, Name again : {n}".format(n=name, a=age))
# eg.
print("Double {x}: {x} + {x} = {sum_x}".format(x=5, sum_x = 5 + 5))
# case 5 : f-string python > 3.6
print(f"Name : {name}, Age : {age}, Name again : {name}")
x = 5
sum_x = 5+5
print(f"Double {5}: {5} + {5} = {5+5}")
print(f"Double {x}: {x} + {x} = {sum_x}")
#temp 4
#format numbers
price = 49.99
tax = 0.08
total = price * (1 + tax)
print(f"Price : ${price:.2f} | Tax : {tax:.1%} | Total: ${total:.2f}")
## f"{variable:[fill][align][width][.precision][type]}
print(f"{age:5d}")
print('1---5----01---5----0')
print(f"{'Name':<10}{'Age':>5}") # < left align, > right align ^ center
#print(f"{name:$<10}{age:->5.2f}")
print(f"{name:<10}{age:->5.2f}")
print(f"{name:<10}{age:->5d}")
print(f"{name:<10}{age:->10.2f}")
print(f"{name:<<10s}{age:->10.2f}{' ':$<10}")
print(f"{'Apple':^10}")
#1---5----01---5----0
#Name Age
#john 10
# Apple
print(f"{42:05}")
print(f"{42:0<5}")
print(f"{1234567:,}")
print(f"{42:5b}") # binary value
print(f"{42:5o}") # octal value
print(f"{42:5x}") # hex value
# scu firnat
print(f"{42:5e}") # value in e format
print(f"{42:5E}") # value in E format
print(f"{13.14564567:.5g}") # 5 sig figure
print(f"{11113.14564567:.5g}") # 5 sig figure
print(f"{1113.14564567:.5g}") # 5 sig figure
print(f"{111113.14564567:.5g}") # 5 sig figure
print(f"{111113.14564567:.5G}") # 5 sig figure
print(f"{0.14122143:.5%}") # 5 sig figure
#temp 5
print(True, False, type(True))
print(False == 0)
x = True and 2 and [1] and {0} and -1.0 and "hello" # truthy value
print(x)
y = False or 0 or [] or {} or None or 0.00 or ' ' # falsy value
print(y)
print("aaa")
print(print(""))
print("bbb")
#==========================================
default_city = 'kw'
city = ''
city = city or print("please input city") or default_city
print(city)
#temp 6
name = ["john", "ann", "mary", "peter", ["ryan", 1], 2, 3, [True, 0,0,9, "hello"]]
print(name, id(name), type(name))
print(name[0], name[4])
print(name[4][0])
name[0] = ["david", 20]
name[4][0]= 'goodman'
print(name)
del name[1]
print(name)