Last active
June 18, 2022 08:30
-
-
Save paley777/02108c4f859bbf7f5edc3abdac1f9349 to your computer and use it in GitHub Desktop.
arithmetic using python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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