Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
211 views20 pages

Jazzcash App Phython Code

The document describes a Python program for a JazzCash mobile banking system with functions for sending money domestically. It includes functions to send money via mobile number, bank account, CNIC, or RAAST ID. Each function prompts the user to enter recipient details and a 4-digit MPIN to confirm the transaction, then prints a confirmation message if successful or an error if invalid inputs. The program provides menus to select the transfer method and recipient's bank or mobile service.

Uploaded by

Muhammad Ali
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
211 views20 pages

Jazzcash App Phython Code

The document describes a Python program for a JazzCash mobile banking system with functions for sending money domestically. It includes functions to send money via mobile number, bank account, CNIC, or RAAST ID. Each function prompts the user to enter recipient details and a 4-digit MPIN to confirm the transaction, then prints a confirmation message if successful or an error if invalid inputs. The program provides menus to select the transfer method and recipient's bank or mobile service.

Uploaded by

Muhammad Ali
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 20

Name: Muhammad Rafi Hussain

Roll No.: SP22-BCS-059


1st Semester Project
Title: JazzCash system by using code *786#

import random

transfer_main=0
bill_main=0
details=[]
bill1=[7654 , 9700, 8459 , 7245 , 8380 , 5678, 9456]
challan1=[500,1000,1500,2000,2500]
main_menu=0
payment_main=0

def send_money():
    global main_menu
    def mobile_account():
        mobile_account = int(input("press\n"+"1.jazzcash\n"+"2.easy paisa\
n"+"0.Back\n"))
        if mobile_account==1:
            account_number=int(input("enter your jazzcash account number: \n"))
            account_number = str(account_number)
            if (len(account_number))  == 10:
                amount = int(input("Enter amount to send: "))
                MPIN = int(input("Enter MPIN to confirm: "))
                MPIN = str(MPIN)
                if (len(MPIN)) == 4:
                    print("Amount has been transfered successfully")
                    exit()
                else:
                    print("invalid MPIN")
                    exit()
            else:
                print("invalid account number")
                exit()
           
        elif mobile_account == 2:
            account_number = int(input("enter your easypaisa account number: \
n"))
           
            account_number = str(account_number)
            if (len(account_number))  == 10:
                amount = int(input("Enter amount to send: "))
                MPIN = int(input("Enter MPIN to confirm: \n"))
                MPIN = str(MPIN)
                if (len(MPIN)) == 4:
                    print("Amount has been transfered successfully")
                    exit()
                else:
                    print("invalid MPIN")
                    exit()
            else:
                print("invalid account number")
                exit()
               
        elif mobile_account==0:
            send_money()
        else:
            print("enter valid option")
           
    def bank():
        global transfer_main
        bank_account = int(input("press\n"+"1.select bank\n"+"2.cancel
transaction\n"+"0.Back\n"))
        if bank_account==1:
            bank_name = int(input("select bank:\n"+"press\n"+"1.HBL\n"+"2.UBL\
n"+"3.Allied\n"+"4.Alfalah\n"+"5.Meezan\n"+"6.MCB\n"+"7.soneri\n"+"0.Back\n"))
            if bank_name==1:
                account_number = int(input("Enter 13 digit HBL Account number\
n(BBBBAAAAAAATT):  \n"))
                account_number=str(account_number)
                if (len(account_number))  == 13:
                    amount = int(input("Enter amount to send: "))
                    MPIN = int(input("Enter MPIN to confirm: "))
                    MPIN = str(MPIN)
                    if (len(MPIN)) == 4:
                        print("Amount has been transfered successfully")
                        exit()
                    else:
                        print("invalid MPIN")
                        exit()
                else:
                    print("invalid account number")
                    exit()
            elif bank_name==2:
                account_number = int(input("Enter 13 digit UBL Account number\
n(BBBBAAAAAAATT):  \n"))
                account_number=str(account_number)
                if (len(account_number))  == 13:
                    amount = int(input("Enter amount to send: "))
                    MPIN = int(input("Enter MPIN to confirm: "))
                    MPIN = str(MPIN)
                    if (len(MPIN)) == 4:
                        print("Amount has been transfered successfully")
                        exit()
                    else:
                        print("invalid MPIN")
                        exit()
                else:
                    print("invalid account number")
                    exit()
            elif bank_name==3:
                account_number = int(input("Enter 13 digit Allied Bank Account
number\n(BBBBAAAAAAATT):  \n"))
                account_number=str(account_number)
                if (len(account_number))  == 13:
                    amount = int(input("Enter amount to send: "))
                    MPIN = int(input("Enter MPIN to confirm: "))
                    MPIN = str(MPIN)
                    if (len(MPIN)) == 4:
                        print("Amount has been transfered successfully")
                        exit()
                    else:
                        print("invalid MPIN")
                else:
                    print("invalid account number")
            elif bank_name==4:
                account_number = int(input("Enter 13 digit Alfalah Bank Account
number\n(BBBBAAAAAAATT):  \n"))
                account_number=str(account_number)
                if (len(account_number))  == 13:
                    amount = int(input("Enter amount to send: "))
                    MPIN = int(input("Enter MPIN to confirm: "))
                    MPIN = str(MPIN)
                    if (len(MPIN)) == 4:
                        print("Amount has been transfered successfully")
                        exit()
                    else:
                        print("invalid MPIN")
                        exit()
                else:
                    print("invalid account number")
                    exit()
            elif bank_name==5:
                account_number = int(input("Enter 13 digit Meezan Bank Account
number\n(BBBBAAAAAAATT):  \n"))
                account_number=str(account_number)
                if (len(account_number))  == 13:
                    amount = int(input("Enter amount to send: "))
                    MPIN = int(input("Enter MPIN to confirm: "))
                    MPIN = str(MPIN)
                    if (len(MPIN)) == 4:
                        print("Amount has been transfered successfully")
                        exit()
                    else:
                        print("invalid MPIN")
                        exit()
                else:
                    print("invalid account number")
                    exit()
            elif bank_name==6:
                account_number = int(input("Enter 13 digit MCB Account number\
n(BBBBAAAAAAATT):  \n"))
                account_number=str(account_number)
                if (len(account_number))  == 13:
                    amount = int(input("Enter amount to send: "))
                    MPIN = int(input("Enter MPIN to confirm: "))
                    MPIN = str(MPIN)
                    if (len(MPIN)) == 4:
                        print("Amount has been transfered successfully")
                        exit()
                    else:
                        print("invalid MPIN")
                        exit()
                else:
                    print("invalid account number")
                    exit()
            elif bank_name==7:
                account_number = int(input("Enter 13 digit Soneri Bank Account
number\n(BBBBAAAAAAATT):  \n"))
                account_number=str(account_number)
                if (len(account_number))  == 13:
                    amount = int(input("Enter amount to send: "))
                    MPIN = int(input("Enter MPIN to confirm: "))
                    MPIN = str(MPIN)
                    if (len(MPIN)) == 4:
                        print("Amount has been transfered successfully")
                        exit()
                    else:
                        print("invalid MPIN")
                        exit()
                else:
                    print("invalid account number")
                    exit()
            elif bank_name==0:
                transfer_main==0
            else:
                print("please enter valid option")
                bank_name==0
        elif bank_account==2:
            print("transaction has been cancelled Successfully!")
            exit()
        elif bank_account==0:
            bank()
        else:
            print("please enter valid option")
            bank_account==0
            exit()
       
    def CNIC():

        global transfer_main
       
        CNIC = int(input("Enter receiver CNIC (13 digits only) : \n"))
        CNIC = str(CNIC)
        if len(CNIC) == 13:
            mobile_number = int(input("Enter Receiver mobile number : \n"))
            mobile_number = str(mobile_number)
            if len(mobile_number)==10:
                Amount = int(input("Enter Amount : \n"))
                MPIN = int(input("Enter MPIN to confirm \n"))
                MPIN = str(MPIN)
                if (len(MPIN)) == 4:
                    print("Amount has been transfered successfully")
                    exit()
                    #transfer_main=0
                else:
                    print("invalid MPIN")
                    exit()
                    #transfer_main=0
            else:
                print("invalid Mobile number")
                exit()
                #transfer_main=0
        else:
            print("invalid CNIC")
            exit()
        #transfer_main=0
    def RAAST():
       
        global transfer_main

        RAAST = int(input("press\n"+"1.RAAST ID\n"+"2.IBAN\n"+"0.Back\n"))


        if RAAST == 1:
            RAAST_ID = int(input("Enter Receiver RAAST ID number (11 digits)"))
            RAAST_ID = str(RAAST_ID)
            if len(RAAST_ID) == 10:
                Amount = int(input("Enter Amount"))
                MPIN = int(input("Enter MPIN to confirm: "))
                MPIN = str(MPIN)
                if (len(MPIN)) == 4:
                    print("Amount has been transfered successfully")
                    exit()
                else:
                    print("invalid MPIN")
                    exit()
            else:
                print("invalid RAAST ID")
                exit()
        elif RAAST == 2:
            IBAN = int(input("Enter Receiver IBAN account number :\n(13 digits
only)\n"))
            IBAN=str(IBAN)
            if len(IBAN) == 13:
                Amount = int(input("Enter Amount"))
                MPIN = int(input("Enter MPIN to confirm: "))
                MPIN = str(MPIN)
                if (len(MPIN)) == 4:
                    print("Amount has been transfered successfully")
                    exit()
                else:
                    print("invalid MPIN")
                    exit()
            else:
                ("invalid IBAN Account Number")
                exit()
        elif RAAST == 0:
            transfer_main=0
        else:
            print("invalid option!please try again")
            RAAST == 0
    def money_transfer():

        global main_menu
        global transfer_main
       
        while transfer_main<=5:
            transfer_main=int(input("press\n"+"1.to mobile account\n"+"2.to
bank\n"+"3.to CNIC\n"+"4.RAASt\n"+"0.back\n"))
                                       
            if transfer_main==1:
                mobile_account()
            elif transfer_main==2:
                bank()
            elif transfer_main==3:
                CNIC()
            elif transfer_main==4:
                RAAST()
            elif transfer_main==0:
                main_menu=0
                #break
            else:
                print("invalid option!\nPlease try again")
                transfer_main=0
    money_transfer()                            

def pay_bill():
   
    def electricity():

        global bill_main
       
        electricity = int(input("press\n"+"1.KESC\n"+"2.IESCO\n"+"3.LESCO \
n"+"4.GEPCO\n"+"5.MEPCO\n"+"6.FESCO\n"+"0.Back\n"))
        if electricity==1:
            ref_num = int(input("Enter your reference number:\n (13 digits
only)"))
            ref_num = str(ref_num)
            if len(ref_num)==13:
                random_index=random.randrange(len(bill1))
                print("Total bill is",bill1[random_index])
                MPIN = int(input("Enter MPIN to confirm :\n(4 digits only)\n"))
                MPIN = str(MPIN)
                if len(MPIN)==4:
                    print("you have Successfully paid bill of RS:" +
str(bill1[random_index])+" with refernce number "+ref_num )
                    exit()
                else:
                    print("invalid MPIN")
                    electricity=0
            else:
                print("invalid Reference Number!")
                electricity=0
        elif electricity == 2:
            ref_num = int(input("Enter your reference number:\n (13 digits
only)"))
            ref_num = str(ref_num)
            if len(ref_num)==13:
                random_index=random.randrange(len(bill1))
                print("Total bill is",bill1[random_index])
                MPIN = int(input("Enter MPIN to confirm :\n(4 digits only)"))
                MPIN = str(MPIN)
                if len(MPIN)==4:
                    print("you have Successfully paid bill of RS:" +
str(bill1[random_index])+" with refernce number "+ref_num )
                    exit()
                else:
                    print("invalid MPIN")
                    electricity=0
            else:
                print("invalid Reference Number!")
                electricity=0
        elif electricity == 3:
            ref_num = int(input("Enter your reference number:\n (13 digits
only)"))
            ref_num = str(ref_num)
            if len(ref_num)==13:
                random_index=random.randrange(len(bill1))
                print("Total bill is",bill1[random_index])
                MPIN = int(input("Enter MPIN to confirm :\n(4 digits only)"))
                MPIN = str(MPIN)
                if len(MPIN)==4:
                    print("you have Successfully paid bill of RS:" +
str(bill1[random_index])+" with refernce number "+ref_num )
                    exit()
                else:
                    print("invalid MPIN")
                    electricity=0
            else:
                print("invalid Reference Number!")
                electricity=0
        elif electricity == 4:
            ref_num = int(input("Enter your reference number:\n (13 digits
only)"))
            ref_num = str(ref_num)
            if len(ref_num)==13:
                random_index=random.randrange(len(bill1))
                print("Total bill is",bill1[random_index])
                MPIN = int(input("Enter MPIN to confirm :\n(4 digits only)"))
                MPIN = str(MPIN)
                if len(MPIN)==4:
                    print("you have Successfully paid bill of RS:" +
str(bill1[random_index])+" with refernce number "+ref_num )
                    exit()
                else:
                    print("invalid MPIN")
                    electricity=0
            else:
                print("invalid Reference Number!")
                electricity=0
        elif electricity == 5:
            ref_num = int(input("Enter your reference number:\n (13 digits
only)"))
            ref_num = str(ref_num)
            if len(ref_num)==13:
                random_index=random.randrange(len(bill1))
                print("Total bill is",bill1[random_index])
                MPIN = int(input("Enter MPIN to confirm :\n(4 digits only)"))
                MPIN = str(MPIN)
                if len(MPIN)==4:
                    print("you have Successfully paid bill of RS:" +
str(bill1[random_index])+" with refernce number "+ref_num )
                    exit()
                else:
                    print("invalid MPIN")
                    electricity=0
            else:
                print("invalid Reference Number!")
                electricity=0
        elif electricity == 6:
            ref_num = int(input("Enter your reference number:\n (13 digits
only)"))
            ref_num = str(ref_num)
            if len(ref_num)==13:
                random_index=random.randrange(len(bill1))
                print("Total bill is",bill1[random_index])
                MPIN = int(input("Enter MPIN to confirm :\n(4 digits only)"))
                MPIN = str(MPIN)
                if len(MPIN)==4:
                    print("you have Successfully paid bill of RS:" +
str(bill1[random_index])+" with refernce number "+ref_num )
                    exit()
                else:
                    print("invalid MPIN")
                    electricity=0
            else:
                print("invalid Reference Number!")
                electricity=0
        elif electricity == 0:
            bill_main=0
        else:
            print("invalid option!\nPlease Try again")
            electricity=0
           
    def gas():
       
        global bill_main
        gas = int(input("press\n"+"1.SSGC\n"+"2.SNGPL\n"+"0.Back\n"))
        if gas==1:
            ref_num = int(input("Enter your reference number:\n (13 digits
only)"))
            ref_num = str(ref_num)
            if len(ref_num)==13:
                random_index=random.randrange(len(bill1))
                print("Total bill is",bill1[random_index])
                MPIN = int(input("Enter MPIN to confirm :\n(4 digits only)"))
                MPIN = str(MPIN)
                if len(MPIN)==4:
                    print("you have Successfully paid bill of RS:" +
str(bill1[random_index])+" with refernce number "+ref_num )
                    exit()
                else:
                    print("invalid MPIN")
                    gas=0
            else:
                print("invalid Reference Number!")
                gas=0
        elif gas==2:
            ref_num = int(input("Enter your reference number:\n (13 digits
only)"))
            ref_num = str(ref_num)
            if len(ref_num)==13:
                random_index=random.randrange(len(bill1))
                print("Total bill is",bill1[random_index])
                MPIN = int(input("Enter MPIN to confirm :\n(4 digits only)"))
                MPIN = str(MPIN)
                if len(MPIN)==4:
                    print("you have Successfully paid bill of RS:" +
str(bill1[random_index])+" with refernce number "+ref_num )
                    exit()
                else:
                    print("invalid MPIN")
                    gas=0
            else:
                print("invalid Reference Number!")
                gas=0
        elif gas ==0:
            bill_main=0
        else:
            print("invalid Option!\nPlease try again")
            gas=0

    def telephone():

        global bill_main
        telephone_bill=int(input("press\n"+"1.PTCL Landline\n"+"2.PTCL Vfone\
n"+"0.Back\n"))
        if telephone_bill==1:
            MDN_num = int(input("Enter your MDN device number:\n (13 digits
only)"))
            MDN_num = str(MDN_num)
            if len(MDN_num)==13:
                random_index=random.randrange(len(bill1))
                print("Total bill is",bill1[random_index])
                MPIN = int(input("Enter MPIN to confirm :\n(4 digits only)"))
                MPIN = str(MPIN)
                if len(MPIN)==4:
                    print("you have Successfully paid bill of RS:" +
str(bill1[random_index])+" with MDN number "+MDN_num )
                    exit()
                else:
                    print("invalid MPIN")
                    telephone_bill=0
            else:
                print("invalid MDN Number!")
                telephone_bill=0
        elif telephone_bill==2:
            MDN_num = int(input("Enter your MDN device number:\n (13 digits
only)"))
            MDN_num = str(MDN_num)
            if len(MDN_num)==13:
                random_index=random.randrange(len(bill1))
                print("Total bill is",bill1[random_index])
                MPIN = int(input("Enter MPIN to confirm :\n(4 digits only)"))
                MPIN = str(MPIN)
                if len(MPIN)==4:
                    print("you have Successfully paid bill of RS:" +
str(bill1[random_index])+" with MDN number "+MDN_num )
                    exit()
                else:
                    print("invalid MPIN")
                    telephone_bill=0
            else:
                print("invalid MDN Number!")
                telephone_bill=0
        elif telephone_bill==0:
            bill_main=0
        else:
            print("invalid option!\nPlease try again")
            telephone_bill=0
       
    def internet():

        global bill_main

        internet_bill=int(input("press\n"+"1.wateen\n"+"2.world call\n"+"3.PTCL\
n"+"4.NayaTel\n"+"0.Back\n"))
        if internet_bill==1:
            MDN_num = int(input("Enter your MDN device number:\n (13 digits
only)"))
            MDN_num = str(MDN_num)
            if len(MDN_num)==13:
                random_index=random.randrange(len(bill1))
                print("Total bill is",bill1[random_index])
                MPIN = int(input("Enter MPIN to confirm :\n(4 digits only)"))
                MPIN = str(MPIN)
                if len(MPIN)==4:
                    print("you have Successfully paid bill of RS:" +
str(bill1[random_index])+" with MDN number "+MDN_num )
                    exit()
                else:
                    print("invalid MPIN")
                    internet_bill=0
            else:
                print("invalid MDN Number!")
                internet_bill=0
        elif internet_bill==2:
            MDN_num = int(input("Enter your MDN device number:\n (13 digits
only)"))
            MDN_num = str(MDN_num)
            if len(MDN_num)==13:
                random_index=random.randrange(len(bill1))
                print("Total bill is",bill1[random_index])
                MPIN = int(input("Enter MPIN to confirm :\n(4 digits only)"))
                MPIN = str(MPIN)
                if len(MPIN)==4:
                    print("you have Successfully paid bill of RS:" +
str(bill1[random_index])+" with MDN number "+MDN_num )
                    exit()
                else:
                    print("invalid MPIN")
                    internet_bill=0
            else:
                print("invalid MDN Number!")
                internet_bill=0
        elif internet_bill==3:
            MDN_num = int(input("Enter your MDN device number:\n (13 digits
only)"))
            MDN_num = str(MDN_num)
            if len(MDN_num)==13:
                random_index=random.randrange(len(bill1))
                print("Total bill is",bill1[random_index])
                MPIN = int(input("Enter MPIN to confirm :\n(4 digits only)"))
                MPIN = str(MPIN)
                if len(MPIN)==4:
                    print("you have Successfully paid bill of RS:" +
str(bill1[random_index])+" with MDN number "+MDN_num )
                    exit()
                else:
                    print("invalid MPIN")
                    internet_bill=0
            else:
                print("invalid MDN Number!")
                internet_bill=0
        elif internet_bill==4:
            MDN_num = int(input("Enter your MDN device number:\n (13 digits
only)"))
            MDN_num = str(MDN_num)
            if len(MDN_num)==13:
                random_index=random.randrange(len(bill1))
                print("Total bill is",bill1[random_index])
                MPIN = int(input("Enter MPIN to confirm :\n(4 digits only)"))
                MPIN = str(MPIN)
                if len(MPIN)==4:
                    print("you have Successfully paid bill of RS:" +
str(bill1[random_index])+" with MDN number "+MDN_num )
                    exit()
                else:
                    print("invalid MPIN")
                    internet_bill=0
            else:
                print("invalid MDN Number!")
                internet_bill=0
        elif internet_bill==0:
            bill_main=0
        else:
            print("invalid option!\nPlease try again")
            internet_bill=0
    def bill():

        global bill_main
        global main_menu
               
        while bill_main!=5:
            if bill_main==0:
                bill_main=int(input("press\n"+"1.electricity\n"+"2.gas\
n"+"3.telephone\n"+"4.internet\n"+"0.back\n"))
                                       
            if bill_main==1:
                electricity()
            elif bill_main==2:
                gas()
            elif bill_main==3:
                telephone()
            elif bill_main==4:
                internet()
            elif bill_main==0:
                break
            else:
                print("invalid option!\nPlease try again")
                bill_main=0
        main_menu=0

    bill()

def mobile_load():
        global main_menu
        global mobile_load
        mobile_load = int(input("press\n"+"1.jazz load\n"+"2.telenor load\
n"+"3.zong load \n"+"4.ufone load\n"+"0.back\n"))
        while mobile_load>=5:
         if mobile_load==1:
            jazz_load = int(input("enter your jazz number: \n"))
            jazz_load = str(jazz_load)
            if len(jazz_load)==10:
                Amount = int(input("Enter Amount : \n"))
                MPIN = int(input("Enter your MPIN to confirm \n"))
                MPIN = str(MPIN)
                if (len(MPIN)) == 4:
                    print("You have Successfully purchased mobile load of RS:
",Amount)
                    exit()
                else:
                    print("invalid MPIN")
                    exit()
            else:
                print("invalid Mobile number")
                exit()
         elif mobile_load == 2:
            Telenor_load = int(input("enter your telenor number: \n"))
            Telenor_load = str(Telenor_load)
            if len(Telenor_load)==10:
                Amount = int(input("Enter Amount : \n"))
                MPIN = int(input("Enter your MPIN to confirm \n"))
                MPIN = str(MPIN)
                if (len(MPIN)) == 4:
                    print("You have Successfully purchased mobile load of RS:
",Amount)
                    exit()
                else:
                    print("invalid MPIN")
                    exit()
            else:
                print("invalid Mobile number")
                exit()
         elif mobile_load ==3:
            Zong_load = int(input("enter your zong number: \n"))
            Zong_load = str(Zong_load)
            if len(Zong_load)==10:
                Amount = int(input("Enter Amount : \n"))
                MPIN = int(input("Enter your MPIN to confirm \n"))
                MPIN = str(MPIN)
                if (len(MPIN)) == 4:
                    print("You have Successfully purchased mobile load of RS:
",Amount)
                    exit()
                else:
                    print("invalid MPIN")
                    exit()
            else:
                print("invalid Mobile number")
                exit()
         elif mobile_load ==4:
            ufone_load = int(input("enter your ufone number: \n"))
            ufone_load = str(ufone_load)
            if len(ufone_load)==10:
                Amount = int(input("Enter Amount : \n"))
                MPIN = int(input("Enter your MPIN to confirm \n"))
                MPIN = str(MPIN)
                if (len(MPIN)) == 4:
                    print("You have Successfully purchased mobile load of RS:
",Amount)
                    exit()
                else:
                    print("invalid MPIN")
                    exit()
            else:
                print("invalid Mobile number")
                exit()
         elif mobile_load==0:
            break
         else:
            print("invalid option!")
            mobile_load=0
            #exit()  
        main_menu=0      
def payment():
        global main_menu
        global payment_main
        while payment_main<=5:
            payment_main=int(input("press\n"+"1.Govt. of punjab Tax Payment\
n"+"2.Donate\n"+"3.Islamabad traffic police\n"+"4.Vaccination certificate\
n"+"0.Back\n"))
            if payment_main==1:
                challan = int(input("Enter Challan ID of Punjab Tax Payment :\
n(14 digits only)"))
                challan = str(challan)
                if len(challan)==14:
                    random_index=random.randrange(len(challan1))
                    print("Total challan is",challan1[random_index])
                    MPIN = int(input("Enter MPIN :\n(4 digits only)"))
                    MPIN = str(MPIN)
                    if len(MPIN)==4:
                        print("challan is successfully paid" )
                        exit()
                    else:
                        print("invalid MPIN")
                        exit()
                else:
                    print("invalid Challan ID")
                    exit()                                    
                    #payment_main=0
            elif payment_main==2:
                donation=int(input("press\n"+"1.Shaukat khanam Memorial Cancer
Hospital\n"+"2.Edhi Foundation\n"+"3.Chippa\n"+"4.Al-Khidmat Foundation\
n"+"5.Indus Hospital\n"+"0.Back\n"))
                if donation==1:
                    amount=int(input("Enter Amount to donate: "))
                    print("You are donating Rs:" + str(amount)+ " to SKMCH")
                    MPIN = int(input("Enter your 4 digits MPIN"))
                    MPIN = str(MPIN)
                    if len(MPIN) ==4:
                        print("you have successfully donate RS:"+str(amount)+ "
to SKMCH" )
                        exit()
                    else:
                        print("invalid MPIN")
                        exit()
                        #payment_main=0
                elif donation==2:
                    amount=int(input("Enter Amount to donate: "))
                    print("You are donating Rs:" + str(amount)+ " to Edhi
Foundation")
                    MPIN = int(input("Enter your 4 digits MPIN"))
                    MPIN = str(MPIN)
                    if len(MPIN) ==4:
                        print("you have successfully donate RS:"+str(amount)+ "
to Edhi Foundation" )
                        exit()
                    else:
                        print("invalid MPIN")
                        exit()
                        #payment_main=0
                elif donation==3:
                    amount=int(input("Enter Amount to donate: "))
                    print("You are donating Rs:" + str(amount)+ " to Chippa")
                    MPIN = int(input("Enter your 4 digits MPIN"))
                    MPIN = str(MPIN)
                    if len(MPIN) ==4:
                        print("you have successfully donate RS:"+str(amount)+ "
to Chippa" )
                        exit()
                    else:
                        print("invalid MPIN")
                        exit()
                        #payment_main=0
                elif donation==4:
                    amount=int(input("Enter Amount to donate: "))
                    print("You are donating Rs:" + str(amount)+ " to Al-Khidmat
Foundation")
                    MPIN = int(input("Enter your 4 digits MPIN"))
                    MPIN = str(MPIN)
                    if len(MPIN) ==4:
                        print("you have successfully donate RS:"+str(amount)+ "
to Al-Khidmat Foundation" )
                        exit()
                    else:
                        print("invalid MPIN")
                        exit()
                        #payment_main=0
                elif donation==5:
                    amount=int(input("Enter Amount to donate: "))
                    print("You are donating Rs:" + str(amount)+ " to Indus
Hospital")
                    MPIN = int(input("Enter your 4 digits MPIN"))
                    MPIN = str(MPIN)
                    if len(MPIN) ==4:
                        print("you have successfully donate RS:"+str(amount)+ "
to Hospital" )
                        exit()
                    else:
                        print("invalid MPIN")
                        exit()
                        #payment_main=0
                elif donation==0:
                    payment_main=0
                else:
                    print("invalid option! Try Again")
                    payment()
            elif payment_main==3:
                challan = int(input("Enter Challan ID of Islamabad Traffic
Police :\n(14 digits only)"))
                challan = str(challan)
                if len(challan)==14:
                    random_index=random.randrange(len(challan1))
                    print("Total challan is",challan1[random_index])
                    MPIN = int(input("Enter MPIN :\n(4 digits only)"))
                    MPIN = str(MPIN)
                    if len(MPIN)==4:
                        print("challan is successfully paid" )
                        exit()
                    else:
                        print("invalid MPIN")
                        payment_main=0
                else:
                    print("invalid Challan ID")                                
                    payment_main=0
            elif payment_main==4:
                CNIC = int(input("Please Enter CNIC: \n(13 digits only)\n"))
                CNIC=str(CNIC)
                if len(CNIC)==13:
                    print("Amount of Vaccination certificate is RS : 350")
                    MPIN = int(input("Enter MPIN :\n(4 digits only)"))
                    MPIN = str(MPIN)
                    if len(MPIN)==4:
                        print("Amount is successfully paid\nNow you are able to
upload your Vaccination certificate from Official Website\nThank you!" )
                        exit()
                    else:
                        print("invalid MPIN")
                        payment_main=0
                else:
                    print("invalid CNIC")
                    payment_main=0
            elif payment_main==0:
                main_menu=0
                break
            else:
                print("invalid option! Try Again")
                payment_main=0
#main page of the system

def main_page():
   
    global main_menu
code = input("Enter JazzCash code: ")
while code!="*786#":
    print("invalid Code!\nTry Again")
    code = input("Enter JazzCash code: ")
print("Welcome to JazzCash")
while main_menu!=4:
 if main_menu==0:
    main_menu=int(input("press\n"+"1. send money\n"+"2. pay bills\n"+"3. mobile
load & bundles\n"+"4. payments \n"+"0. exit\n"))
                                   
    if main_menu==1:  
        send_money()
    elif main_menu==2:
        pay_bill()
    elif main_menu==3:
        mobile_load()
    elif main_menu==4:
        payment()
    elif main_menu==0:
        exit()
    else:
        print("Please enter valid option")
        main_menu=0
main_page()

You might also like