[Tutor] I am having trouble getting some associations to work

Tom Linsenmeyer tlinsenmeyer at gmail.com
Sun Feb 27 15:09:28 EST 2022


I cannot get either self or getmakecar and getmaketruck to associate with
self or def getmakecar() and getmaketruck(). I can get one or the other not
both

Can you please help me
Thank you


import sys
import time


#A program to make a virtual garage

class Vehicles:


  def __init__(self, fueltype, make, carmodel, truckmodel, color):
        """ initialize attributes."""
        self.carmodel = carmodel
        self.truckmodel= truckmodel
        self.Make_ = make
        self.Color_ = color
        self.fueltype_ = fueltype
        make = {'Make1' : 'Chevrolet', 'Make2' : 'Dodge', 'Make3' : 'Ford'}
        carmodel = {'Cmodel' : 'Camaro', "Cmodel2" : 'Corvette',
'Cmodel3' : 'Charger', 'Cmodel4' : 'Challenger'}
        truckmodel = {'Tmodel1' : 'Silverado', 'Tmodel2' :
'Tahoe','Tmodel3' : 'Ram-1500', 'Tmodel4' :'Ram-2500',' Tmodel5' :'F-150',
'Model_' : 'F-250'}
        fueltype = {'fuelType1' : 'Gasoline', 'fuelType2' : 'Diesel',
'fuelType3' : 'FlexFuel'}
        color = {'Color1' : 'White', 'Color2' : 'Black', 'Color3' : 'Blue',
'Color4' : 'Red', 'Color5' : 'Yellow'}

  def mainmenu(self):

          print("Welcome to your garage! Please make a selection")
          print("1: Car")
          print("2: Truck")
          print("3: Quit")
          choice = int(input())
          if choice == 1:
            print("Car")
            getmaker()
          #elif choice == 2:
           # getmakeTruck()
          elif choice == 3:
              quit()
          else:
              print ("Select either Car, Truck or Quit")


  def getmakecar(self):
        print('Pick from cars')
        #self.make#[Make1],[Make2],[Make3]

  def quit(self):
      print("Leaving your garage")
      time.sleep(2)
      sys.exit()



  def getmaketruck(self):
                pass
#class Car(Vehicles):
#  def carmenu():
  #      print("Car Menu")
   # choice = int(input("""
    #                        1: Make
     #                       2: Model
      #                      3: Color
       #                     4: Fuel Type
        #                    5: Options
         #                   6: Quit
          #                          """))


   # if choice == 1:
    #      make()
    #elif choice == 2:
   #     model()
    #elif choice == 3:
     #   color()
    #elif choice == 4:
  #      fueltype()
    #elif choice == 5:
 #    3   options()
   # elif choice == 6:
    #    else:
    #car_menu()

 #   def make(Vehicles):





#options = ['powerlocks', 'powerwindows','powermirrors', 'powerseat',
'premium_sound', 'back_up_camera', 'leather_seats','trailer_package']
#print (make)

-- 
Tom Linsenmeyer
https://emrisinternational.com/Robin


More information about the Tutor mailing list