Fakultas Ilmu Komputer UI

TP5_1906399915.py 868 Bytes
Newer Older
Ruly Achmad Gemilang Gultom's avatar
Ruly Achmad Gemilang Gultom committed
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
26
27
28
29
30
import urllib.request
import urllib.parse


page = urllib.request.urlopen("https://ceritanyatuwiter.herokuapp.com/1906399915")
text = page.read().decode("utf8")

print(text)
disalurkan = 1
#stok_sekarang =
#laporkan_stok = 
stok = ambil_info_stok()


def laporkan_stok:
    param = urllib.parse.urlencode({"pesan":"Stok  Terkini: stok_sekarang"})
    resp = urllib.request.urlopen("https://ceritanyatuwiter.herokuapp.com/1906399915/lapor",param.encode())
def ambil_info_stok:
    


while stok >0 and disalurkan > 0:
    disalurkan = input("masukkan jumlah tabung yang disalurkan: ")
    if disalurkan > 0:
        if disalurkan > stok:
            print("stok tidak cukup")
        else:
            print("penyaluran jumlah disalurkan tabung berhasil. sekarang tersisa stok - disalurkan")
            laporkan_stok(stok - disalurkan)
        stok = ambil_info_stok()