ISHLATAOLMAGAN KODLARIM :
1
import requests
def scrape( ):
response = requests.get(URL + COIN)
response_json = response.json( )
return float(response_json[0]['price_usd'])
URL ='https://t.me/shahrixon_yangiliklari'
COIN = "SO'M"
last_price = None
while True:
latest_price = scrape()
if latest_price != last_price:
print("Oxirgi narx : ",latest_price)
last_price = latest_price
2
from prettytable import PrettyTable
x= PrettyTable()
x.field_name = ["O'quvchilar", "Sinf", "Ball", "Hulqi"]
x.add_row(["Behruz", 5, 4, "Yaxshi"])
x.add_row(["Temur", 7, 5, "Na'munali"])
x.add_row(["Firdavs", 8, 4, "Yaxshi" ])
x.add_column("Tel.nomer", [9999, 8888, 7777])
print(x)
print(py_lug.get(soz,"Bunday so'z mavjud emas"))
soz = input("Kalit so'zni kiriting: ").lower()
mano = py_lug.get(soz)
if mano ==None:
print("Bunday so'z mavjud emas")
else:
print(f"{soz.title()} so'zini ma'nosi quyidagicha :{mano}")
yosh = float(input("Yoshingiz nechada: "))
yosh+="(dasturni to'xtatish uchun ): "
while yosh != 'exit' or 'quit':
if yosh>0 and yosh<=7:
print("Sizga chipta bepul!")
yosh=input(yosh)
elif yosh>=8 and yosh <= 18:
print("Sizga chipta narxi 10.000 so'm!")
elif yosh>18 and yosh<=60:
print("Sizga chipta narxi 20.000 so'm!")
elif yosh>60 and yosh<=80:
print("Sizga chipta narxi 15000 so'm!")
elif yosh>80:
print("Sizga chipta bepul!")
Dostları ilə paylaş: |