Listing Program
x=0
while x!=3:
print '===================='
print '====== Log In ======'
print '===================='
a=raw_input('Username: ')
b=raw_input('Password: ')
if a == 'Adjie' and b == 'blank':
print 'Login Successed'
print ''
print ''
print ''
print ''
y=0
while y!=1:
print '=============================='
print '============ Menu ============'
print '=============================='
print '= 1. Luas Segitiga ='
print '= 2. Luas Persegi ='
print '= 3. Luas Lingkaran ='
print '= 4. Kalkulator ='
print '= 5. Array Nama ='
print '= 6. Deret Fibonacci ='
print '= 7. Deret Bilangan Ganjil ='
print '= 8. Deret Bilangan Genap ='
print '= 9. Deret Bilangan Asli ='
print '= 10. Keluar ='
print '=============================='
c=raw_input('Masukkan Menu Pilihan di Atas: ')
if c == '1':
alas=float(input('Masukkan Alas Segitiga: '))
tinggi=float(input('Masukkan Tinggi Segitiga: '))
print 'Luas Segitiga:',alas*tinggi/2
print ''
if y!=1:
bb=raw_input('Do You Want to Exit (y/n)? ')
if bb=='y':
print 'Program Close'
print ''
break
else:
print 'Back to Menu'
print ''
elif c == '2':
sisi=input('Masukkan Sisi Persegi: ')
print 'Luas Persegi:',sisi**2
print ''
if y!=1:
bc=raw_input('Do You Want to Exit (y/n)? ')
if bc=='y':
print 'Program Close'
print ''
break
else:
print 'Back to Menu'
print ''
elif c == '3':
jari_jari=float(input('Masukkan Jari-jari Lingkaran: '))
print 'Luas Lingkaran:',3.14*jari_jari*jari_jari
print ''
if y!=1:
bd=raw_input('Do You Want to Exit (y/n)? ')
if bd=='y':
print 'Program Close'
print ''
break
else:
print 'Back to Menu'
print ''
elif c == '4':
ab=float(input('Masukkan Angka Pertama: '))
ac=float(input('Masukkan Angka Kedua: '))
print 'Hasil Penjumlahan:',ab+ac
print 'Hasil Pengurangan:',ab-ac
print 'Hasil Perkalian:',ab*ac
print 'Hasil Pembagian:',ab/ac
print 'Hasil Modulus:',int(ab%ac)
print ''
if y!=1:
be=raw_input('Do You Want to Exit (y/n)? ')
if be=='y':
print 'Program Close'
print ''
break
else:
print 'Back to Menu'
print ''
elif c == '5':
data=input('Masukkan Banyak Data: ')
base=[]
loop=0
while loop!=data:
print 'Masukkan Nama ke ',loop+1,': ',
nama=raw_input()
base.append(nama)
loop=loop+1
if loop == data:
print 'Nama-nama yang Telah Dimasukkan:', base
print ''
if y!=1:
bf=raw_input('Do You Want to Exit (y/n)? ')
if bf=='y':
print 'Program Close'
print ''
break
else:
print 'Back to Menu'
print ''
elif c == '6':
angka=input('Masukkan Panjang Deret: ')
d = [0,1]
for z in range (angka):
if z>1:
print d[z-1]+d[z-2],
d.append(d[z-1]+d[z-2])
else:
print d[z],
print ''
print ''
if y!=1:
bg=raw_input('Do You Want to Exit (y/n)? ')
if bg=='y':
print 'Program Close'
print ''
break
else:
print 'Back to Menu'
print ''
elif c == '7':
ganjil=input('Masukkan Angka Deret yang Terakhir: ')
def bilanganganjil(af):
while af!=ganjil:
print af,
af=af+2
print ganjil
bilanganganjil(1)
print ''
if y!=1:
bh=raw_input('Do You Want to Exit (y/n)? ')
if bh=='y':
print 'Program Close'
print ''
break
else:
print 'Back to Menu'
print ''
elif c == '8':
genap=input('Masukkan Angka Deret yang Terakhir: ')
def bilangangenap(ag):
ag=ag-1
while ag!=genap:
print ag,
ag=ag+2
print genap
bilangangenap(1)
print ''
if y!=1:
bi=raw_input('Do You Want to Exit (y/n)? ')
if bi=='y':
print 'Program Close'
print ''
break
else:
print 'Back to Menu'
print ''
elif c == '9':
asli=input('Masukkan Panjang Deret: ')
def bilanganasli(az):
az=az-1
while az!=asli:
az=az+1
print az,
print ''
print ''
bilanganasli(1)
if y!=1:
bj=raw_input('Do You Want to Exit (y/n)? ')
if bj=='y':
print 'Program Close'
print ''
break
else:
print 'Back to Menu'
print ''
elif c == '10':
ex=raw_input('Are You Sure to Exit (y/n)? ')
if ex == 'y':
print 'Program Exit'
print ''
break
else:
print 'Program Back to Menu'
print ''
else:
print 'Program Back to Menu'
print ''
elif a == 'exit' and b == 'exit':
e=raw_input('Are You Sure to Cancel Login (y/n)? ')
if e == 'y':
print 'Program Close'
print ''
break
else:
print 'Please Try Again to Login'
print ''
elif a == 'Adjie' or b == 'blank':
print 'Username or Password is Incorrect'
print 'Please Try Again'
print ''
else:
print 'Please Try Again'
print ''
x=x+1
if x==3:
print 'You Have Three Times to Login'
while x!=3:
print '===================='
print '====== Log In ======'
print '===================='
a=raw_input('Username: ')
b=raw_input('Password: ')
if a == 'Adjie' and b == 'blank':
print 'Login Successed'
print ''
print ''
print ''
print ''
y=0
while y!=1:
print '=============================='
print '============ Menu ============'
print '=============================='
print '= 1. Luas Segitiga ='
print '= 2. Luas Persegi ='
print '= 3. Luas Lingkaran ='
print '= 4. Kalkulator ='
print '= 5. Array Nama ='
print '= 6. Deret Fibonacci ='
print '= 7. Deret Bilangan Ganjil ='
print '= 8. Deret Bilangan Genap ='
print '= 9. Deret Bilangan Asli ='
print '= 10. Keluar ='
print '=============================='
c=raw_input('Masukkan Menu Pilihan di Atas: ')
if c == '1':
alas=float(input('Masukkan Alas Segitiga: '))
tinggi=float(input('Masukkan Tinggi Segitiga: '))
print 'Luas Segitiga:',alas*tinggi/2
print ''
if y!=1:
bb=raw_input('Do You Want to Exit (y/n)? ')
if bb=='y':
print 'Program Close'
print ''
break
else:
print 'Back to Menu'
print ''
elif c == '2':
sisi=input('Masukkan Sisi Persegi: ')
print 'Luas Persegi:',sisi**2
print ''
if y!=1:
bc=raw_input('Do You Want to Exit (y/n)? ')
if bc=='y':
print 'Program Close'
print ''
break
else:
print 'Back to Menu'
print ''
elif c == '3':
jari_jari=float(input('Masukkan Jari-jari Lingkaran: '))
print 'Luas Lingkaran:',3.14*jari_jari*jari_jari
print ''
if y!=1:
bd=raw_input('Do You Want to Exit (y/n)? ')
if bd=='y':
print 'Program Close'
print ''
break
else:
print 'Back to Menu'
print ''
elif c == '4':
ab=float(input('Masukkan Angka Pertama: '))
ac=float(input('Masukkan Angka Kedua: '))
print 'Hasil Penjumlahan:',ab+ac
print 'Hasil Pengurangan:',ab-ac
print 'Hasil Perkalian:',ab*ac
print 'Hasil Pembagian:',ab/ac
print 'Hasil Modulus:',int(ab%ac)
print ''
if y!=1:
be=raw_input('Do You Want to Exit (y/n)? ')
if be=='y':
print 'Program Close'
print ''
break
else:
print 'Back to Menu'
print ''
elif c == '5':
data=input('Masukkan Banyak Data: ')
base=[]
loop=0
while loop!=data:
print 'Masukkan Nama ke ',loop+1,': ',
nama=raw_input()
base.append(nama)
loop=loop+1
if loop == data:
print 'Nama-nama yang Telah Dimasukkan:', base
print ''
if y!=1:
bf=raw_input('Do You Want to Exit (y/n)? ')
if bf=='y':
print 'Program Close'
print ''
break
else:
print 'Back to Menu'
print ''
elif c == '6':
angka=input('Masukkan Panjang Deret: ')
d = [0,1]
for z in range (angka):
if z>1:
print d[z-1]+d[z-2],
d.append(d[z-1]+d[z-2])
else:
print d[z],
print ''
print ''
if y!=1:
bg=raw_input('Do You Want to Exit (y/n)? ')
if bg=='y':
print 'Program Close'
print ''
break
else:
print 'Back to Menu'
print ''
elif c == '7':
ganjil=input('Masukkan Angka Deret yang Terakhir: ')
def bilanganganjil(af):
while af!=ganjil:
print af,
af=af+2
print ganjil
bilanganganjil(1)
print ''
if y!=1:
bh=raw_input('Do You Want to Exit (y/n)? ')
if bh=='y':
print 'Program Close'
print ''
break
else:
print 'Back to Menu'
print ''
elif c == '8':
genap=input('Masukkan Angka Deret yang Terakhir: ')
def bilangangenap(ag):
ag=ag-1
while ag!=genap:
print ag,
ag=ag+2
print genap
bilangangenap(1)
print ''
if y!=1:
bi=raw_input('Do You Want to Exit (y/n)? ')
if bi=='y':
print 'Program Close'
print ''
break
else:
print 'Back to Menu'
print ''
elif c == '9':
asli=input('Masukkan Panjang Deret: ')
def bilanganasli(az):
az=az-1
while az!=asli:
az=az+1
print az,
print ''
print ''
bilanganasli(1)
if y!=1:
bj=raw_input('Do You Want to Exit (y/n)? ')
if bj=='y':
print 'Program Close'
print ''
break
else:
print 'Back to Menu'
print ''
elif c == '10':
ex=raw_input('Are You Sure to Exit (y/n)? ')
if ex == 'y':
print 'Program Exit'
print ''
break
else:
print 'Program Back to Menu'
print ''
else:
print 'Program Back to Menu'
print ''
elif a == 'exit' and b == 'exit':
e=raw_input('Are You Sure to Cancel Login (y/n)? ')
if e == 'y':
print 'Program Close'
print ''
break
else:
print 'Please Try Again to Login'
print ''
elif a == 'Adjie' or b == 'blank':
print 'Username or Password is Incorrect'
print 'Please Try Again'
print ''
else:
print 'Please Try Again'
print ''
x=x+1
if x==3:
print 'You Have Three Times to Login'
Output Program
No comments:
Post a Comment