Skip to content

Instantly share code, notes, and snippets.

@paley777
Last active June 18, 2022 08:30
Show Gist options
  • Save paley777/02108c4f859bbf7f5edc3abdac1f9349 to your computer and use it in GitHub Desktop.
Save paley777/02108c4f859bbf7f5edc3abdac1f9349 to your computer and use it in GitHub Desktop.
arithmetic using python
print("Kalkulator Sederhana Python")
print("1. Penjumlahan")
print("2. Pengurangan")
print("3. Perkalian")
print("4. Pembagian")
pil = int(input("\nMasukan Pilihan Operasi : "))
x= int(input("Bilangan 1 : "))
y= int(input("Bilangan 2 : "))
if pil == 1:
hasil = x+y
elif pil == 2:
hasil = x-y
elif pil == 3:
hasil = x*y
elif pil == 4:
hasil = x/y
print("\nHasil : %d" %hasil)
print("Apakah Benar?")
pil1 = (input("\nYa atau Tidak (Y/T) : "))
if pil1 == "Y":
print("Mantap!")
else:
print("OUT!")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment