Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
need solution to code
#9
ive wrote this code so far.

class batch:
    def _init_(self, batch_number, components_in_batch):
        self.batch_number = batch_number
        self.components_in_batch = components_in_batch

class component:
    def _init_(self, type, size):
        self.type = type
        self.size = size

def batch_number():
    batch_number = batch_number + 1
    print("batch number is " + currentDT.strftime("%d%m%y") + str(batch_number).zfill(4))


    components_list = ["1 = Winglet Strut", "2 = Door Handle", "3 = Rudder Pin"]
    print(components_list)



    #if (        component == 1
     #      and size == 1
       # ):
       # print("you have selected Winglet Strut A320 Series")
        #if component == 1 and size == 2:
         #  print("you have selected Winglet Strut A320 Series")
print("please select an option")#
print("1 = create a batch")
print("0 = exit")
while True:
    choice = input("> ")
    if choice == '1':
        print("welcome to the program")
        break
    elif choice == '0':
        print("you have selected to exit program")
        break
    else:
        print("invalid choice")
    print()

while True:
    print("what component?")
    component = input("> ")
    if component == '1':
        print("you have selected Winglet Strut.")
        break
    elif component == '2':
        print("you have selected Door Handle")
        break
    elif component == '3':
        print("you have selected Rudder Pin")
        break
    else:
        print("invalid choice")
sizes_list = ["1 = A320 Series", "2 = A380 Series"]
print(sizes_list)
while True:
    print("Please select the size of the of the component")
    size = input("> ")
    if size == '1':
        print("you have selected the A320 Series")
        break
    elif size == '2':
        print("you have selected the A380 Series")
        break
    else:
        print("invalid choice")

while True:
    if component == 1 and size == 1:
        print("you have selected Winglet Strut A320 Series")
        break
    elif component == 1 and size == 2:
        print("you have selected Winglet Strut A380 Series")
        break
    elif component == 2 and size == 1:
        print("you have selected Door Handle A320 Series")
        break
    elif component == 2 and size == 2:
        print("you have selected Door Handle A380 Series")
        break
    elif component == 3 and size == 1:
        print("you have selected Rudder Pin A320 Series")
        break
    elif component == 3 and size == 2:
        print("you have selected Rudder Pin A380 Series")
        break
    else:
        print("invalid process")
        break
it works until the last while loop it goes straight to invalid process on that one so not sure how to get it to read the results from the previous 2 while loops.
Reply


Messages In This Thread
need solution to code - by mccluregamer4472 - Feb-23-2019, 02:00 AM
RE: need solution to code - by Larz60+ - Feb-23-2019, 02:39 AM
RE: need solution to code - by mccluregamer4472 - Feb-23-2019, 04:03 PM
RE: need solution to code - by Larz60+ - Feb-23-2019, 04:54 PM
RE: need solution to code - by mccluregamer4472 - Feb-23-2019, 04:59 PM
RE: need solution to code - by manish1m97 - Feb-23-2019, 05:01 PM
RE: need solution to code - by Larz60+ - Feb-23-2019, 05:57 PM
RE: need solution to code - by mccluregamer4472 - Feb-23-2019, 06:26 PM
RE: need solution to code - by mccluregamer4472 - Feb-27-2019, 11:12 AM
RE: need solution to code - by mccluregamer4472 - Mar-04-2019, 12:40 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  please looking for typo in my code (solution please) jamie_01 1 1,294 Jan-12-2022, 06:45 AM
Last Post: Gribouillis
  Newbie - code solution explained Stjude1982 2 1,870 Sep-16-2021, 08:54 AM
Last Post: Stjude1982
  Quick Help - Timers - Need Small Solution for Working Code EwH006 5 4,083 Nov-17-2020, 04:09 AM
Last Post: EwH006
  Multiplication Recursive Solution - What's Going On Inside the Code? emerger 1 2,641 Mar-04-2018, 07:11 AM
Last Post: ka06059
  Question on babynames.py solution code? Athenaeum 3 4,509 Feb-20-2018, 06:20 AM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020