Selasa, 21 Maret 2017

LA AP2B 2

print "Selamat Datang"
tanya="Y"
password=raw_input("Masukan Password : ")
if password=="1IA20":
            print "Welcome !!!\n"
            while tanya=="Y" or tanya=="y":
                        print "=====Menu====="
                        print "1. Faktorial"
                        print "2. Nilai IPK"
                        print "3. Luas Segitiga"
                        print "4. Exit\n"
                       
                        pil=input("Masukan Pilihan Anda : ")
                        if pil==1:
                                    print "\nProgram Faktorial\n"
                                    z=1
                                    x = input("Masukan Sembarang Angka : ")
                                   
                                    for i in range(x,0,-1):
                                                if i<2:
                                                            print i,"=",
                                                else:
                                                            print i,"x",
                                                z = z*i
                                    print z
                        elif pil==2:
                                    print "\nPerhitungan Nilai IPK\n"
                                    uts=input("Masukan Nilai UTS : ")
                                    uas=input("Masukan Nilai UAS : ")
                                    score=(0.3*uas)+(0.7*uts)
                                    if score >= 90:
                                                print('Nilai Anda A')
                                    elif score >= 80:
                                                print('Nilai Anda B')
                                    elif score >= 70:
                                                print('Nilai Anda C')
                                    elif score >= 60:
                                                print('Nilai Anda D')
                                    else:
                                                print('Anda Tidak Lulus')
                        elif pil==3:
                                    print "\nProgram Luas Segitiga\n"
                                    alas=input("Masukan Panjang Alas : ")
                                    tinggi=input("Masukan Tinggi Segitiga : ")
                                    luas=alas*tinggi*0.5
                                    print "Info Segitiga : "
                                    print "Alas = ",alas
                                    print "Tinggi = ",tinggi
                                    print "Luas = ",luas
                        elif pil==4:
                                    print "Terimakasih"
                                    break
                        else:
                                    print "Pilihan Tidak Ada"
                                    print "Silahkan Coba Lagi\n"
                       
                        tanya=raw_input("Ulang ? [Y/N]")

Tidak ada komentar:

Posting Komentar