Create a Flow Chart for the following Python function (def orme ( ) ):
Posted: Sun Jul 03, 2022 11:22 am
Create a Flow Chart for the following Python function(def orme ( ) ):
527 def orme (): 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 fhand-open('medicine.txt', 'r') for line in fhand: line-line.rstrip () print (line) fhand.close() ch=int (input ('Do you want to order medicine? 1. Yes \t2.No and Leave')) if (ch==1): fhand = open('medicine.txt', 'r') lines = fhand.readlines () while True: while True: data=input('Enter any medicine number you want to order: ') for line in lines: 1=line.split('\t') if not data in 1: continue print (1) x=int ((line.split('\t') [4])) no-int (input('Please enter number you want to order: ')) order=x*no print ('You need to pay RM¹ +str (order)) print('\nPlease enter these information to order') fhand-open('order.txt', 'a') User_ID=input('Please enter your User_ID :') medicine_no=input('Please enter medicinde number :') address=input('Please enter your address :') fhand.write('\n'+User_ID+'\t'+medicine_no+'\t'+address) fhand.write('\t'+str (no)) fhand.write('\t'+str (x)) fhand.write('\t'+str (order)) fhand.close()
561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 elif (ch==2): else: fhand.write('\t'+str (order)) personalin () fhand.close() z=int (input('Please select the bank you want to pay with: 1.Maybank \t2. Hong LeongBank \t3. PublicBank')) while True: if (z==1): print ('You have successfully paid') elif (z==2): print ('You have successfully paid') elif (z==3): break orme () break for line in lines: print ('You have successfully paid') print('Invalid Choice, Please Enter 1-3') else: 1= line.split('\t') if not data in 1: break print ('Medecine not found, please try again') break print('Invalid Choice, Please Enter 1 or 2') orme ()
527 def orme (): 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 fhand-open('medicine.txt', 'r') for line in fhand: line-line.rstrip () print (line) fhand.close() ch=int (input ('Do you want to order medicine? 1. Yes \t2.No and Leave')) if (ch==1): fhand = open('medicine.txt', 'r') lines = fhand.readlines () while True: while True: data=input('Enter any medicine number you want to order: ') for line in lines: 1=line.split('\t') if not data in 1: continue print (1) x=int ((line.split('\t') [4])) no-int (input('Please enter number you want to order: ')) order=x*no print ('You need to pay RM¹ +str (order)) print('\nPlease enter these information to order') fhand-open('order.txt', 'a') User_ID=input('Please enter your User_ID :') medicine_no=input('Please enter medicinde number :') address=input('Please enter your address :') fhand.write('\n'+User_ID+'\t'+medicine_no+'\t'+address) fhand.write('\t'+str (no)) fhand.write('\t'+str (x)) fhand.write('\t'+str (order)) fhand.close()
561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 elif (ch==2): else: fhand.write('\t'+str (order)) personalin () fhand.close() z=int (input('Please select the bank you want to pay with: 1.Maybank \t2. Hong LeongBank \t3. PublicBank')) while True: if (z==1): print ('You have successfully paid') elif (z==2): print ('You have successfully paid') elif (z==3): break orme () break for line in lines: print ('You have successfully paid') print('Invalid Choice, Please Enter 1-3') else: 1= line.split('\t') if not data in 1: break print ('Medecine not found, please try again') break print('Invalid Choice, Please Enter 1 or 2') orme ()