Why does my program not printing values after Q pressed?

These are the problems..

  1. Create an abstract class to store information of network infrastructure assets. The name of the class is: NetworkInfrastructureAsset.

  2. The class must store: • the serial number (must be 10 characters long) • device brand (must be a maximum of 10 characters long) • model number (must be 10 characters long) • price (must be a float)

  3. Create an abstract method in NetworkInfrastructureAsset that prints out the data inside the NetworkInfrastructureAsset object. Call this method print_data().

  4. A network infrastructure asset can be a PC, a Monitor, a Router or a UPS. These assets inherit the NetworkInfrastructureAsset class. The student should declare these four sub-classes, and add additional attributes to each sub-class using their own judgement. Add at least 2 attributes to each of the four sub-classes.

For example, • In the PC sub-class, add the attributes screenWidth, • In the UPS sub-class, add the attribute batteryReplacementDate

  1. Over-ride the print_data() method in NetworkInfrastructureAsset in each of the four classes so that it prints the entire data in the class.

  2. Write a while loop that lets the use enter the network infrastructure assets, until the user presses “Q”, at which point the while loop should break. Each iteration, the loop will ask the user to choose the network infrastructure assets (whether it is a PC, a Monitor, a Router or a UPS). According to the choice made, the user will be prompted to enter the required information. After entering all the required information of the network infrastructure asset, the relevant object is created and then added to a list. Call that list list_of_assets.

  3. Place the input operation in a try-except block. If the user inputs an invalid value for the price, let the user know of the error and try again.

  4. Write a loop that iterates through list_of_assets and calls the print_data() method in each asset

And here is the code I programmed.Code is running But I face some problems. **Output is not printing **problem with Try-Except

If anyone can support that will be huge support.

from abc import ABCMeta, abstractmethod
import re
class NetworkInfrastructureAsset(metaclass=ABCMeta):
  
    @abstractmethod
    def __init__(self, serial_number, brand, model_number, price):
        self.serial_number = serial_number
        self.brand = brand
        self.model_number = model_number
        self.price = price
  
    @abstractmethod
    def print_data(self):
        print(self.serial_number)
        print(self.brand)
        print(self.model_number)
        print(self.price)

class PC(NetworkInfrastructureAsset):
    def __init__(self,serial_number, brand, model_number, price, screenWidth,screenType):
        super().__init__(serial_number, brand, model_number, price)
        self.screenWidth = screenWidth
        self.screenType = screenType
  
    def print_data(self):
        print(self.serial_number)
        print(self.brand)
        print(self.model_number)
        print(self.price)
        print(self.screenWidth)
        print(self.screenType)


class UPS(NetworkInfrastructureAsset):
    def __init__(self,serial_number, brand, model_number, price, replaceDate,aquiredDate):
        super().__init__(serial_number, brand, model_number, price)
        self.replaceDate = replaceDate
        self.aquiredDate = aquiredDate
  
    def print_data(self):
        print(self.serial_number)
        print(self.brand)
        print(self.model_number)
        print(self.price)
        print(self.replaceDate)
        print(self.aquiredDate)


class Monitor(NetworkInfrastructureAsset):
    def __init__(self,serial_number, brand, model_number, price, color,monitor_type):
        super().__init__(serial_number, brand, model_number, price)
        self.color = color
        self.monitor_type = monitor_type
  
    def print_data(self):
        print(self.serial_number)
        print(self.brand)
        print(self.model_number)
        print(self.price)
        print(self.color)
        print(self.monitor_type)


class Router(NetworkInfrastructureAsset):
    def __init__(self,serial_number, brand, model_number, price, usb_ports,external_storage):
        super().__init__(serial_number, brand, model_number, price)
        self.usb_ports = usb_ports
        self.external_storage = external_storage
  
    def print_data(self):
        print(self.serial_number)
        print(self.brand)
        print(self.model_number)
        print(self.price)
        print(self.usb_ports)
        print(self.external_storage)


    list_of_assets = []

    def input_for_pc():
        while True:
            user_serial_number = input("Enter serial number:")
            if (re.match("[A-Za-z0-9]+", user_serial_number)) and (len(user_serial_number)==10):
                    break
            else:
                print("Serial number must be 10 characters long")
  
    while True:
        user_brand = input("Enter brand:")
        if (re.match("[A-Za-z0-9]+", user_brand)) and (len(user_brand)<=10):
            break
        else:
            print("Brand must be a maximum of 10 characters long")

    while True:
        user_model_number = input("Enter model number:")
        if (re.match("[A-Za-z0-9]+", user_model_number)) and (len(user_model_number)==10):
            break
        else:
            print("Model number must be 10 characters long")

    while True:
        try:
            user_price = float(input("Enter price:"))
            if type(user_price)==float:
                print(user_price)
            break
        
        except:
                print("Price must be float")
      
        screenWidth = input("Enter screenWidth:")
      
        screenType = input("Enter screenType:")
      
        ob = PC(user_serial_number,user_brand,user_model_number,user_price,screenWidth,screenType)
      
        list_of_assets.append(ob)


    def input_for_ups():
        while True:
            user_serial_number = input("Enter serial number:")
            if (re.match("[A-Za-z0-9]+", user_serial_number)) and (len(user_serial_number)==10):
                break
        else:
            print("Serial number must be 10 characters long")
  
    while True:
        user_brand = input("Enter brand:")
        if (re.match("[A-Za-z0-9]+", user_brand)) and (len(user_brand)<=10):
            break
        else:
            print("Brand must be a maximum of 10 characters long")

    while True:
        user_model_number = input("Enter model number: ")
        if (re.match("[A-Za-z0-9]+", user_model_number)) and (len(user_model_number)==10):
            break
        else:
            print("Model number must be 10 characters long")

    while True:
        try:
            user_price = float(input("Enter price: "))
            if type(user_price)==float:
                print(user_price)
                break
        except:
            
            print("Price must be float")
            replaceDate = input("Enter replaceDate: ")
            aquiredDate = input("Enter aquiredDate: ")
            ob = UPS(user_serial_number,user_brand,user_model_number,user_price,replaceDate,aquiredDate)
            list_of_assets.append(ob)

    def inputfor_monitor():
        while True:
            user_serial_number = input("Enter serial number: ")
            if (re.match("[A-Za-z0-9]+", user_serial_number)) and (len(user_serial_number)==10):
                break
            else:
                print("Serial number must be 10 characters long")

    while True:
        user_brand = input("Enter brand: ")
        if (re.match("[A-Za-z0-9]+", user_brand)) and (len(user_brand)<=10):
            break
        else:
            print("Brand must be a maximum of 10 characters long")

    while True:
        user_model_number = input("Enter model number: ")
        if (re.match("[A-Za-z0-9]+", user_model_number)) and (len(user_model_number)==10):
            break
        else:
            print("Model number must be 10 characters long")

    while True:
        try:
            user_price = float(input("Enter price: "))
            if type(user_price)==float:
                print(user_price)
                break
        except:
            print("Price must be float")
            color = input("Enter color: ")
            monitor_type = input("Enter monitor_type: ")
            ob = Monitor(user_serial_number,user_brand,user_model_number,user_price,color,monitor_type)
            list_of_assets.append(ob)

    def input_for_router():
        while True:
            user_serial_number = input("Enter serial number: ")
            if (re.match("^[a-z]*$", user_serial_number)) and (len(user_serial_number)==10):
                break
            else:
                print("Serial number must be 10 characters long")
      
    while True:
        user_brand = input("Enter brand:")
        if (re.match("^[a-z]*$", user_brand)) and (len(user_brand)<=10):
            break
        else:
            print("Brand must be a maximum of 10 characters long")

    while True:
        user_model_number = input("Enter model number: ")
        if (re.match("^[a-z]*$", user_model_number)) and (len(user_model_number)==10):
            break
        else:
            print("Model number must be 10 characters long")

        while True:
            try:
                user_price = float(input("Enter price: "))
                if type(user_price)==float:
                    print(user_price)
                    break
                    
            except:
                
                print("Price must be float")
                usb_ports = input("Enter usb_ports: ")
                external_storage = input("Enter external_storage: ")
                ob = Router(user_serial_number,user_brand,user_model_number,user_price,usb_ports,external_storage)
                list_of_assets.append(ob)


    while True:
        user_input = input("Select network infrastructure asset:\nPC\nMonitor\nRouter\nUPS\nEnter 'Q' to quit ")
        if user_input == 'Q':
            break
        elif user_input == 'PC' or '1':
            input_for_pc()
        elif user_input == 'Monitor':
            input_for_ups()
        elif user_input == 'Router':
            input_for_monitor()
        elif user_input == 'UPS':
            input_for_router()
        for obj in list_of_assets:
            obj.print_data()
            print()