Best Python code snippet using localstack_python
main.py
Source:main.py
...53 print('Sorry, I do not understand.')54 print('')55 get_name()56 57def empty_response(): # For empty responses (Do you really think I wouldn't have patched that?)58 cls()59 print("Please answer the respective question.")60 sleep(3)61 62def unavailable(): # If something is unavailable63 cls()64 random1 = random.sample(random_choice, 1)65 abc = input('Sorry, the thing you\'re looking for is currently unavailable.\n \nWould you like to try our delicious {}? (Enter either \'Yes\' or \'No\')\n\n> ' .format(*random1))66 print('')67 68 if abc == 'yes' or abc == 'YES' or abc == 'Yes' or abc == 'y' or abc == 'Y' and abc.isalpha() and len(abc) > 0:69 new_list.append(*random1)70 71 if new_list.count('Bread cheesecakes') > 0:72 bread_cheesecake()73 74 elif new_list.count('No egg cheesecakes') > 0:75 no_egg_cheesecake()76 77 elif new_list.count('Low amount cheese cheesecakes') > 0:78 low_amount_cheese()79 80 elif new_list.count('Egg cheesecakes') > 0:81 egg_cheesecake()82 83 elif new_list.count('Cappucino') > 0:84 cappucino()85 86 elif abc == 'no' or abc == 'NO' or abc == 'No' or abc == 'n' or abc == 'N' and abc.isalpha() and len(abc) > 0:87 cls()88 print('Okay, some other time.')89 print('')90 order()91 92 elif abc != 'yes' or abc != 'Yes' or abc != 'YES' or abc != 'y' or abc != 'Y' or abc != 'no' or abc != 'No' or abc != 'NO' or abc != 'N' or abc != 'n':93 print('Enter only \'Yes\' or \'No\'')94 unavailable()95 96 elif len(abc) == 0:97 print('Error, response empty.')98 unavailable()99 100 elif abc != abc.isalpha():101 print('Please enter only \'Yes\' or \'No\'')102 unavailable()103 104 else:105 print('Sorry I do not understand.')106 unavailable()107def order2(shop_name = 'Bharat Cheesecakes'): # For ordering different types of items.108 print('')109 choice = input('Do you want to order something else? (Enter either \'Yes\' or \'No\' )\n\n> ')110 111 if choice == 'yes' or choice == 'YES' or choice == 'Yes' or choice == 'Y' or choice == 'y' and choice.isalpha() and len(choice) > 0:112 cls()113 order()114 return cart115 116 elif choice == 'No' or choice == 'no' or choice == 'NO' or choice == 'N' or choice == 'n' and choice.isalpha() and len(choice) > 0:117 cls()118 print("Here is your final order: ") #\n{} .format(*cart))119 print('')120 for items in cart:121 print('{}\n' .format(items))122 print('')123 abc = input('Thank you for shopping with {}.\n\nPress Enter to exit program. \n \n' .format(shop_name))124 125 if len(abc) > 0:126 exit()127 128 else:129 exit()130 131 elif choice != 'yes' or choice != 'no':132 empty_response()133 order2()134 135 elif len(choice) == 0:136 empty_response()137 order2()138 139 elif choice != choice.isalpha():140 empty_response()141 order2()142 he143 else:144 print('Sorry, I do not understand.')145 order2()146 147 148def random_suggestion(): # For suggesting random things149 cls()150 suggestion_sample = random.sample(random_choice, 1)151 will = input('We think you would like our {}.\n \nDo you wish to continue? Enter either \'Yes\' or \'No\'.\n\n> '.format(*suggestion_sample))152 153 if will == 'yes' or will == 'YES' or will == 'Yes' or will == 'Y' or will == 'y' and will.isalpha() and len(will) > 0:154 new_list.append(*suggestion_sample)155 156 if new_list.count('Bread cheesecakes') > 0:157 bread_cheesecake()158 159 elif new_list.count('No egg cheesecakes') > 0:160 no_egg_cheesecake()161 162 elif new_list.count('Low amount cheese cheesecakes') > 0:163 low_amount_cheese()164 165 elif new_list.count('Egg cheesecakes') > 0:166 egg_cheesecake()167 168 elif new_list.count('Cappucino') > 0:169 cappucino()170 171 elif will == 'no' or will == 'NO' or will == 'No' or will == 'N' or will == 'n' and will.isalpha() and len(will) > 0:172 cls()173 print('Okay, some other time.')174 print('')175 order()176 elif will != 'no' or will != 'NO' or will != 'No' or will != 'N' or will != 'n' or will != 'Yes' or will != 'YES' or will != 'yes' or will != 'Y' or will != 'y':177 empty_response()178 random_suggestion()179 180def bread_cheesecake():181 cls()182 choice = input("What type of Bread cheesecake do you want? \n \na) Double sided Bread cheesecake \nb) Single sided Bread cheesecake \n\nEnter the respective option \'a\', \'b\', or enter \'1\' to go back to menu. \n> ")183 184 if choice == 'a' or choice == 'A' or choice == 'a)' or choice == 'A)' and choice.isalpha() and len(choice) > 0:185 cls()186 187 while cart.count('10 pieces of Double sided Bread cheesecake.') == 0:188 189 try:190 pieces = int(input("And how many pieces of Double sided Bread cheesecake do you want?\n\n> "))191 192 if pieces == 1:193 cls()194 print("Here is your order:\n\n{} piece Double sided Bread cheesecake." .format(pieces))195 cart.append("{} piece Double sided Bread cheesecake.".format(pieces))196 order2()197 return counter198 199 elif pieces == 0:200 empty_response()201 bread_cheesecake()202 203 elif pieces > 10:204 limit()205 bread_cheesecake()206 207 elif pieces != 1:208 cls()209 print("Here is your order:\n\n{} pieces of double sided Bread cheesecake." .format(pieces))210 cart.append("{} pieces of Double sided Bread cheesecake.".format(pieces))211 order2()212 213 else:214 empty_response()215 bread_cheesecake()216 217 except ValueError:218 empty_response()219 bread_cheesecake()220 221 if cart.count('10 pieces of Double sided Bread cheesecake.') > 0:222 limit_reached()223 bread_cheesecake()224 225 else:226 limit_reached()227 bread_cheesecake()228 229 elif choice == 'b' or choice == 'B' or choice == 'b)' or choice == 'B)' and choice.isalpha() and len(choice) > 0:230 cls()231 try:232 pieces = int(input("And how many pieces of single sided bread cheesecake do you want?\n\n> "))233 234 if pieces == 1:235 cls()236 print("Here is your order:\n\n{} piece single sided Bread cheesecake.".format(pieces))237 cart.append("{} piece single sided Bread cheesecake.".format(pieces))238 order2()239 return cart240 241 elif pieces == 0:242 empty_response()243 bread_cheesecake()244 245 elif pieces > 10:246 limit()247 bread_cheesecake()248 249 elif pieces != 1:250 cls()251 print('Here is your order:\n\n{} pieces of single sided bread cheesecake.' .format(pieces))252 cart.append("{} pieces of single sided bread cheesecake." .format(pieces))253 order2()254 return cart255 256 elif len(pieces) >= 0:257 empty_response()258 bread_cheesecake()259 260 except ValueError:261 empty_response()262 bread_cheesecake()263 264 elif choice != 'a' or choice != 'b':265 try:266 try:267 if int(choice) == 1:268 order()269 270 elif int(choice) > 1 or int(choice) < 1 or int(choice) == 0:271 empty_response()272 bread_cheesecake()273 274 except choice !=1:275 empty_response()276 bread_cheesecake()277 278 except TypeError:279 empty_response()280 bread_cheesecake()281 282 elif choice != choice.isalpha():283 empty_response()284 bread_cheesecake()285 286 elif len(choice) == 0:287 empty_response()288 bread_cheesecake()289 290 else:291 print('Sorry I do not understand.')292 bread_cheesecake()293 294def no_egg_cheesecake():295 cls()296 choice = input("What flavour of cheesecake without egg do you want?\n\na) Chocolate \nb) Vanilla \nc) Strawberry \nd) Blackberry \n \nEnter the respective option \'a\', \'b\', \'c\', \'d\', or enter \'1\' to go back to menu.\n\n> ")297 298 if choice == 'a' or choice == 'A' or choice == 'a)' or choice == 'A)' and choice.isalpha() and len(choice) > 0:299 cls()300 choco = input('And what type of chocolate flavour do you want?\n\na) Normal chocolate \nb) Dark chocolate\n\n> ')301 302 if choco == 'a' or choco == 'A' or choco == 'a)' or choco == 'A)':303 cls()304 305 while cart.count('10 piece of Normal chocolate cheesecake without eggs.') == 0:306 try:307 pieces = int(input("And how many pieces of Normal chocolate cheesecake without eggs do you want?\n\n> "))308 309 if pieces == 1:310 print('')311 print("Here is your order:\n\n{} piece Normal chocolate cheesecake without eggs." .format(pieces))312 cart.append("{} piece Normal chocolate cheesecake without eggs.".format(pieces))313 order2()314 return cart315 316 elif pieces == 0:317 empty_response()318 no_egg_cheesecake()319 320 elif pieces > 10:321 limit()322 no_egg_cheesecake()323 324 elif pieces != 1:325 cls()326 print("Here is your order:\n\n{} pieces of Normal chocolate cheesecake without eggs." .format(pieces))327 cart.append("{} pieces of Normal chocolate cheesecake without eggs.".format(pieces))328 order2()329 return cart330 331 else:332 empty_response()333 no_egg_cheesecake()334 335 except ValueError:336 empty_response()337 no_egg_cheesecake()338 339 if cart.count('10 piece of Normal chocolate cheesecake without eggs.') > 0:340 limit_reached()341 no_egg_cheesecake()342 343 else:344 limit_reached()345 no_egg_cheesecake()346 347 elif choco == 'b' or choco == 'B' or choco == 'B)' or choco =='b)':348 unavailable()349 350 elif choco != choco.isalpha():351 empty_response()352 no_egg-cheesecake()353 354 elif len(choco) == 0:355 empty_response()356 no_egg_cheesecake()357 358 elif choco != 'a' or choco != 'b':359 empty_response()360 no_egg_cheesecake()361 else:362 print("Sorry I do not understand")363 no_egg_cheesecake()364 365 elif choice == 'b' or choice == 'B' or choice == 'b)' or choice == 'B)' and choice.isalpha() and len(choice) > 0:366 cls()367 368 try:369 pieces = int(input("And how many pieces of Vanilla cheesecake without eggs do you want?\n\n> "))370 371 if pieces == 1:372 cls()373 print("Here is your order:\n\n{} piece Vanilla cheesecake without eggs.".format(pieces))374 cart.append("{} piece single Vanilla cheesecake without eggs.".format(pieces))375 order2()376 return cart377 378 elif pieces > 10:379 limit()380 no_egg_cheesecake()381 382 elif pieces == 0:383 empty_response()384 no_egg_cheesecake()385 386 elif pieces != 1:387 cls()388 print('Here is your order:\n\n{} pieces of Vanilla cheesecake without eggs.' .format(pieces))389 cart.append("{} pieces of Vanilla cheesecake without eggs." .format(pieces))390 order2()391 392 elif len(pieces) >= 0:393 empty_response()394 no_egg_cheesecake()395 396 except ValueError:397 empty_response()398 no_egg_cheesecake()399 400 elif choice == 'c' or choice == 'C' or choice == 'c)' or choice == 'C)' and choice.isalpha() and len(choice) >0:401 cls()402 403 try:404 pieces = int(input("And how many pieces of Strawberry cheesecake without eggs do you want?\n\n> "))405 if pieces == 1:406 cls()407 print("Here is your order:\n\n{} piece Strawberry cheesecake without eggs.".format(pieces))408 cart.append("{} piece single Strawberry cheesecake without eggs.".format(pieces))409 order2()410 return cart411 412 elif pieces == 0:413 empty_response()414 no_egg_cheesecake()415 416 elif pieces > 10:417 limit()418 no_egg_cheesecake()419 420 elif pieces != 1:421 cls()422 print('Here is your order:\n\n{} pieces of Strawberry cheesecake without eggs.' .format(pieces))423 cart.append("{} pieces of Strawberry cheesecake without eggs." .format(pieces))424 order2()425 return cart426 427 elif len(pieces) >= 0:428 empty_response()429 no_egg_cheesecake()430 431 except ValueError:432 empty_response()433 no_egg_cheesecake()434 435 elif choice == 'd' or choice == 'D' or choice == "D)" or choice =='d)' and choice.isalpha() and len(choice) > 0:436 unavailable()437 438 elif choice != 'a' or choice != 'b' or choice != 'c' or choice != 'd':439 try:440 try:441 if int(choice) == 1:442 order()443 444 elif int(choice) > 1 or int(choice) < 1 or int(choice) == 0:445 empty_response()446 no_egg_cheesecake()447 448 except choice !=1:449 empty_response()450 no_egg_cheesecake()451 452 except TypeError:453 empty_response()454 no_egg_cheesecake()455 456 elif choice != choice.isalpha():457 empty_response()458 no_egg_cheesecake()459 460 elif len(choice) == 0:461 empty_response()462 no_egg_cheesecake()463 464 else:465 print('Sorry, I do not understand.')466def low_amount_cheese():467 cls()468 choice = input("Which flavour of low amount cheese cheesecake do you want?\n\na) Chocolate \nb) Vanilla \n \nEnter the respective option \'a\', \'b\' or enter \'1\' to go back to menu.\n\n> ")469 470 if choice == 'a' or choice == 'A' or choice == 'A)' or choice == 'a)' and choice.isalpha() and len(choice) > 0:471 cls()472 473 p_choice = input('And how much amount of cheese do you want?\n\na) 25% \nb) 50% \nc) 75% \n \nEnter the respective option \'a\', \'b\', \'c\', or enter \'1\' to go back to menu.\n\n> ')474 475 if p_choice == 'a' or p_choice == 'A' or p_choice == 'a)' or p_choice == 'A)' and p_choice.isalpha() and len(p_choice) > 0:476 cls()477 478 try:479 amount = int(input('And how many such cheesecakes do you want?\n\n> '))480 if amount == 1:481 cls()482 print('Here is your order:\n\n{} piece chocolate cheesecake with 25% cheese.' .format(amount))483 cart.append('{} piece chocolate cheesecake with 25% cheese.' .format(amount))484 order2()485 return cart486 487 if amount == 0:488 empty_response()489 low_amount_cheese()490 491 elif amount > 10:492 limit()493 low_amount_cheese()494 495 elif amount != 1:496 cls()497 print('Here is your order:\n\n{} pieces of chocolate cheesecake with 25% cheese.' .format(amount))498 cart.append('{} pieces of chocolate cheesecake with 25% cheese.' .format(amount))499 order2()500 return cart501 502 else:503 empty_response()504 low_amount_cheese()505 506 except ValueError:507 empty_response()508 low_amount_cheese()509 510 elif p_choice == 'b' or p_choice == 'B' or p_choice == 'b)' or p_choice == 'B)' and p_choice.isalpha() and len(p_choice) > 0:511 cls()512 513 try:514 amount = int(input('And how many such cheesecakes do you want?\n\n> '))515 if amount == 1:516 cls()517 print('Here is your order:\n\n{} piece chocolate cheesecake with 50% cheese.' .format(amount))518 cart.append('{} piece chocolate cheesecake with 50% cheese.' .format(amount))519 order2()520 return cart521 522 elif amount > 10:523 limit()524 low_amount_cheese()525 526 elif amount > 1:527 cls()528 print('Here is your order:\n\n{} pieces of chocolate cheesecake with 50% cheese.' .format(amount))529 cart.append('{} pieces of chocolate cheesecake with 50% cheese.' .format(amount))530 order2()531 return cart532 533 elif amount == 0:534 empty_response()535 low_amount_cheese()536 537 else:538 empty_response()539 low_amount_cheese()540 541 except ValueError:542 empty_response()543 low_amount_cheese()544 545 elif p_choice == 'c' or p_choice == 'C' or p_choice == 'c)' or p_choice == 'C)' and p_choice.isalpha() and len(p_choice) > 0:546 unavailable()547 548 elif p_choice != 'a' or p_choice != 'b' or p_choice != 'c':549 try:550 try:551 if int(p_choice) == 1:552 order()553 554 elif int(p_choice) > 1 or int(p_choice) < 1 or int(p_choice) == 0:555 empty_response()556 low_amount_cheese()557 558 except p_choice !=1:559 empty_response()560 low_amount_cheese()561 562 except TypeError:563 empty_response()564 low_amount_cheese()565 566 elif p_choice != p_choice.isalpha():567 print('Please enter only alphabets.')568 print('')569 low_amount_cheese()570 571 elif len(p_choice) == 0:572 empty_response()573 low_amount_cheese()574 575 else:576 print('Sorry I do not understand.')577 print('')578 low_amount_cheese()579 580 elif choice == 'b' or choice == 'B' or choice == 'b)' or choice == 'B)' and choice.isalpha() and len(choice) > 0:581 cls()582 p_choice = input('And how much amount of cheese do you want?\n\na) 25% \nb) 50% \nc) 75%\n\n> ')583 584 if p_choice == 'a' or p_choice == 'A' or p_choice == 'a)' or p_choice == 'A)' and p_choice.isalpha() and len(p_choice) > 0:585 cls()586 try:587 amount = int(input('And how many such cheesecakes do you want?\n\n> '))588 if amount == 1:589 cls()590 print('Here is your order:\n\n{} piece Vanilla cheesecake with 25% cheese.' .format(amount))591 cart.append('{} piece Vanilla cheesecake with 25% cheese.' .format(amount))592 order2()593 return cart594 595 elif amount > 10:596 limit()597 low_amount_cheese()598 599 elif amount > 1:600 cls()601 print('Here is your order:\n\n{} pieces of Vanilla cheesecake with 25% cheese.' .format(amount))602 cart.append('{} pieces of Vanilla cheesecake with 25% cheese.' .format(amount))603 order2()604 return cart605 606 elif amount == 0:607 empty_response()608 low_amount_cheese()609 610 else:611 empty_response()612 low_amount_cheese()613 614 except ValueError:615 empty_response()616 low_amount_cheese()617 618 elif p_choice == 'b' or p_choice == 'B' or p_choice == 'b)' or p_choice == 'B)' and p_choice.isalpha() and len(p_choice) > 0:619 cls()620 621 try:622 amount = int(input('And how many such cheesecakes do you want?\n\n> '))623 624 if amount == 1:625 cls()626 print('Here is your order:\n\n{} piece Vanilla cheesecake with 50% cheese.' .format(amount))627 cart.append('{} piece Vanilla cheesecake with 50% cheese.' .format(amount))628 order2()629 return cart630 631 elif amount > 10:632 limit()633 low_amount_cheese()634 635 elif amount > 1:636 cls()637 print('Here is your order:\n\n{} pieces of Vanilla cheesecake with 50% cheese.' .format(amount))638 cart.append('{} pieces of Vanilla cheesecake with 50% cheese.' .format(amount))639 order2()640 return cart641 642 elif amount == 0:643 empty_response()644 low_amount_cheese()645 646 else:647 empty_response()648 low_amount_cheese()649 650 except ValueError:651 empty_response()652 low_amount_cheese()653 654 elif p_choice == 'c' or p_choice == 'C' or p_choice == 'c)' or p_choice == 'C)' and p_choice.isalpha() and len(p_choice) > 0:655 unavailable()656 657 elif p_choice != 'a' or p_choice != 'b' or p_choice != 'c' or p_choice != 'A' or p_choice != 'B' or p_choice != 'C':658 empty_response()659 low_amount_cheese()660 661 elif choice != 'a' or choice != 'b':662 try:663 try:664 665 if int(choice) == 1:666 order()667 668 elif int(choice) > 1 or int(choice) < 1 or int(choice) == 0:669 empty_response()670 low_amountcheese()671 672 except choice !=1:673 empty_response()674 low_amount_cheese()675 676 except TypeError:677 empty_response()678 low_amount_cheese()679 680 elif choice != choice.isalpha():681 empty_response()682 low_amount_cheese()683 684 elif len(choice) == 0:685 empty_response()686 low_amount_cheese()687 688 else:689 print('Sorry, I do not understand.')690 print('')691 low_amount_cheese()692 693def egg_cheesecake():694 cls()695 choice = input("What flavour cheesecake do you want?\n\na) Chocolate \nb) Vanilla \nc) Strawberry \nd) Blackberry\n\n> ")696 697 if choice == 'a' or choice == 'A' or choice == 'a)' or choice == 'A)' and choice.isalpha() and len(choice) > 0:698 cls()699 choco = input('And what type of chocolate flavour do you want?\n\na) Normal chocolate \nb) Dark chocolate\n\n> ')700 701 if choco == 'a' or choco == 'A' or choco == 'a)' or choco == 'A)':702 cls()703 704 try:705 pieces = int(input("And how many pieces of Normal chocolate cheesecake do you want?\n\n> "))706 707 if pieces == 1:708 cls()709 print("Here is your order:\n\n{} piece Normal chocolate cheesecake." .format(pieces))710 cart.append("{} piece Normal chocolate cheesecake.".format(pieces))711 order2()712 return cart713 714 elif pieces == 0:715 empty_response()716 egg_cheesecake()717 718 elif pieces > 10:719 limit()720 egg_cheesecake()721 722 elif pieces != 1:723 cls()724 print("Here is your order:\n\n{} pieces of Normal chocolate cheesecake." .format(pieces))725 cart.append("{} pieces of Normal chocolate cheesecake.".format(pieces))726 order2()727 return cart728 729 else:730 empty_response()731 egg_cheesecake()732 733 except ValueError:734 empty_response()735 egg_cheesecake()736 737 elif choco == 'b' or choco == 'B' or choco == 'B)' or choco =='b)':738 cls()739 try:740 pieces = int(input("And how many pieces of Dark chocolate cheesecake do you want?\n\n> "))741 742 if pieces == 1:743 cls()744 print("Here is your order:\n\n{} piece Dark chocolate cheesecake." .format(pieces))745 cart.append("{} piece Dark chocolate cheesecake.".format(pieces))746 order2()747 return cart748 749 elif pieces == 0:750 empty_response()751 egg_cheesecake()752 753 elif pieces > 10:754 limit()755 egg_cheesecake()756 757 elif pieces != 1:758 cls()759 print("Here is your order:\n\n{} pieces of Dark chocolate cheesecake." .format(pieces))760 cart.append("{} pieces of Dark chocolate cheesecake.".format(pieces))761 order2()762 return cart763 764 else:765 empty_response()766 egg_cheesecake()767 768 except ValueError:769 empty_response()770 egg_cheesecake()771 772 elif choco != choco.isalpha():773 empty_response()774 egg-cheesecake()775 776 elif len(choco) == 0:777 empty_response()778 egg_cheesecake()779 780 elif choco != 'a' or choco != 'b':781 empty_response()782 egg_cheesecake()783 784 else:785 print("Sorry I do not understand")786 egg_cheesecake()787 788 elif choice == 'b' or choice == 'B' or choice == 'b)' or choice == 'B)' and choice.isalpha() and len(choice) > 0:789 cls()790 791 try:792 pieces = int(input("And how many pieces of Vanilla cheesecake do you want?\n\n> "))793 794 if pieces == 1:795 cls()796 print("Here is your order:\n\n{} piece Vanilla cheesecake.".format(pieces))797 cart.append("{} piece single Vanilla cheesecake.".format(pieces))798 order2()799 return cart800 801 elif pieces == 0:802 empty_response()803 egg_cheesecake()804 805 elif pieces > 10:806 limit()807 egg_cheesecake()808 809 elif pieces != 1:810 cls()811 print('Here is your order:\n\n{} pieces of Vanilla cheesecake.' .format(pieces))812 cart.append("{} pieces of Vanilla cheesecake." .format(pieces))813 order2()814 return cart815 816 elif len(pieces) >= 0:817 empty_response()818 egg_cheesecake()819 820 except ValueError:821 empty_response()822 egg_cheesecake()823 824 elif choice == 'c' or choice == 'C' or choice == 'c)' or choice == 'C)' and choice.isalpha() and len(choice) >0:825 cls()826 827 try:828 pieces = int(input("And how many pieces of Strawberry cheesecake do you want?\n\n> "))829 830 if pieces == 1:831 cls()832 print("Here is your order:\n\n{} piece Strawberry cheesecake.".format(pieces))833 cart.append("{} piece single Strawberry cheesecake.".format(pieces))834 order2()835 return cart836 837 elif pieces == 0:838 empty_response()839 egg_cheesecake()840 841 elif pieces > 10:842 limit()843 egg_cheesecake()844 845 elif pieces != 1:846 cls()847 print('Here is your order:\n\n{} pieces of Strawberry cheesecake.' .format(pieces))848 cart.append("{} pieces of Strawberry cheesecake." .format(pieces))849 order2()850 return cart851 852 elif len(pieces) >= 0:853 empty_response()854 egg_cheesecake()855 856 except ValueError:857 empty_response()858 egg_cheesecake()859 860 elif choice == 'd' or choice == 'D' or choice == "D)" or choice =='d)' and choice.isalpha() and len(choice) > 0:861 cls()862 863 try:864 pieces = int(input("And how many pieces of Blackberry cheesecake do you want?\n\n> "))865 866 if pieces == 1:867 cls()868 print("Here is your order:\n\n{} piece Blackberry cheesecake.".format(pieces))869 cart.append("{} piece single Blackberry cheesecake.".format(pieces))870 order2()871 return cart872 873 elif pieces == 0:874 empty_response()875 egg_cheesecake()876 877 elif pieces > 10:878 limit()879 egg_cheesecake()880 881 elif pieces != 1:882 cls()883 print('Here is your order:\n\n{} pieces of Blackberry cheesecake.' .format(pieces))884 cart.append("{} pieces of Blackberry cheesecake." .format(pieces))885 order2()886 return cart887 888 elif len(pieces) >= 0:889 empty_response()890 egg_cheesecake()891 892 except ValueError:893 empty_response()894 egg_cheesecake()895 896 elif choice != 'a' or choice != 'b' or choice != 'c' or choice != 'd':897 empty_response()898 egg_cheesecake()899 900 elif choice != choice.isalpha():901 empty_response()902 egg_cheesecake()903 904 elif len(choice) == 0:905 empty_response()906 egg_cheesecake()907 908 else:909 print('Sorry, I do not understand.')910 egg_cheesecake()911 912def cappucino():913 cls()914 choice = input('What Cappucino size do you want?\n \na) Small \nb) Medium \nc) Large \n\nPlease enter either \'a\', \'b\' or \'c\'.\n\n> ')915 916 if choice == 'a' or choice == 'A' or choice == 'a)' or choice == 'A)' and choice.isalpha() and len(choice) > 0:917 unavailable()918 919 elif choice == 'b' or choice == 'B' or choice == 'b)' or choice == 'B)' and choice.isalpha() and len(choice) > 0:920 cls()921 922 try:923 pieces = int(input("And how many Medium Cappucino glasses do you want?\n\n> "))924 925 if pieces == 1:926 cls()927 print("Here is your order:\n\n{} Medium Cappucino glass.".format(pieces))928 cart.append("{} Medium Cappucino glass.".format(pieces))929 order2()930 return cart931 932 elif pieces == 0:933 empty_response()934 cappucino()935 936 elif pieces > 10:937 limit()938 cappucino()939 940 elif pieces != 1:941 cls()942 print('Here is your order:\n\n{} Medium Cappucino glasses.' .format(pieces))943 cart.append("{} Medium Cappucino glasses." .format(pieces))944 order2()945 return cart946 947 elif len(pieces) >= 0:948 empty_response()949 cappucino()950 951 except ValueError:952 empty_response()953 cappucino()954 955 elif choice == 'c' or choice == 'C' or choice == 'c)' or choice == 'C)' and choice.isalpha() and len(choice) > 0:956 cls()957 958 try:959 pieces = int(input("And how many Large Cappucino glasses do you want?\n\n> "))960 961 if pieces == 1:962 cls()963 print("Here is your order:\n\n{} Large Cappucino glass.".format(pieces))964 cart.append("{} Large Cappucino glass.".format(pieces))965 order2()966 return cart967 968 elif pieces == 0:969 empty_response()970 cappucino()971 972 elif pieces > 10:973 limit()974 cappucino()975 976 elif pieces != 1:977 cls()978 print('Here is your order:\n\n{} Large Cappucino glasses.' .format(pieces))979 cart.append("{} Large Cappucino glasses." .format(pieces))980 order2()981 return cart982 983 elif len(pieces) >= 0:984 empty_response()985 cappucino()986 987 except ValueError:988 empty_response()989 cappucino()990 991 elif choice != 'c' or choice != 'C':992 empty_response()993 cappucino()994 995 elif choice != choice.isalpha():996 print('Please enter only alphabets.')997 print('')998 cappucino()999 1000 elif len(choice) == 0:1001 empty_response()1002 cappucino()1003 1004 else:1005 print('Sorry, I do not understand.')1006 print('')1007 cappucino()1008def order():1009 print("Here is our menu: \n\na) Bread cheesecake \nb) No egg cheesecake \nc) Low amount cheese cheesecake \nd) Egg cheesecake \ne) Cappucino \nf) Suggest something random")1010 print('')1011 choice = input("Enter the respective option \'a\', \'b\', \'c\', \'d\', \'e\', \'f\' or enter \'1\' to exit program.\n\n> ")1012 1013 if choice == 'a' or choice == 'A' or choice == 'a)' or choice == 'A)' and choice.isalpha() and len(choice) > 0:1014 bread_cheesecake()1015 1016 elif choice == 'b' or choice == 'B' or choice == 'b)' or choice == 'B)' and choice.isalpha() and len(choice) > 0:1017 no_egg_cheesecake()1018 1019 elif choice == 'c' or choice == 'C' or choice == 'C)' or choice == 'c)' and choice.isalpha() and len(choice) > 0:1020 low_amount_cheese()1021 1022 elif choice == 'd' or choice == 'D' or choice == 'D)' or choice == 'd)' and choice.isalpha() and len(choice) > 0:1023 egg_cheesecake()1024 1025 elif choice == 'e' or choice == 'E' or choice == 'E)' or choice == 'e)' and choice.isalpha() and len(choice) > 0:1026 cappucino()1027 1028 elif choice == 'f' or choice == 'F' or choice == 'f)' or choice == 'F)' and choice.isalpha() and len(choice) > 0:1029 random_suggestion()1030 1031 elif choice != 'a' or choice != 'b' or choice != 'c' or choice != 'd' or choice != 'e' or choice != 'f':1032 try:1033 try:1034 if choice == 1:1035 exit()1036 1037 elif int(choice) > 1 or int(choice) < 1 or int(choice) == 0:1038 empty_response()1039 order()1040 1041 except choice !=1: # WHY ARE YOU HERE RN???1042 empty_response()1043 order()1044 1045 except TypeError:1046 empty_response()1047 order()1048 1049 elif choice != choice.isalpha():1050 empty_response()1051 print('')1052 order()1053 1054 elif len(choice) == 0:1055 empty_response()1056 print('')1057 order()1058 ...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!