How would I go about fixing this block of code? - python

The code below is supposed to output the following if you choose employee
Do you wish to enter data for an (E)mployee, a (S)alesperson, or would you like to (Q)uit?: e
Enter the name of the employee: (employee name)
Enter (employee name) hourly pay rate: (pay rate)
Enter (employee name) hours worked: (hours worked ```
Employee data:
Employee name: (employee name)
Employee hourly pay: (hourly pay)
Hours worked: (hours worked)
Pay: (pay)
That is if you choose the to enter data for an employee ^^^
Here is the following output if you would like the choose the following data for a Salesperson
Do you wish to enter data for an (E)mployee, a (S)alesperson, or would you like to (Q)uit?: s
Enter the name of the employee: (employee name)
Enter (employee name) hourly pay rate: (hourly pay)
Enter the number of hours worked by (employee name): (hours worked)
Enter the amount of sales made by (employee name): (sales made)
Enter the commission percentage that will be earned by (employee name): (commission percentage)
Salesperson data:
Employee name: (employee name)
Employee hourly pay: (hourly pay)
Hours worked: (hours worked)
Sales: (sales made)
Commission percentage: (commission percent)
Pay: (pay)
Here is the entire block of code that is executing all of this. Keep in mind that this has to be done using classes and polymorphism.
class Employee:
def __init__(self, hours_worked, hourly_rate):
self.__hours_worked = 0
self.__hourly_rate = 0
def set_hours_worked(self, hours_worked):
self.__hours_worked = hours_worked
def get_hours_worked(self):
return self.__hours_worked
def set_hourly_rate(self, hourly_rate):
self.__hourly_rate = hourly_rate
def get_hourly_rate(self):
return self.__hourly_rate
def calc_pay(self):
return self.__hourly_rate * self.__hours_worked
def __str_(self):
print()
string1 = 'Employee data: ' + '\n' + 'Employee name: ' + employee_name + '\n' + 'Employee hourly pay rate: ' + employee_pay + '\n' + 'Hours worked: ' + employee_hours + '\n' + 'Pay: ' + employee_pay
class Salesman(Employee):
def __init__(self, weekly_sales, commission, hours_worked, hourly_rate):
Employee.__init__(self, hours_worked, hourly_rate)
self.__weekly_sales = 0
self.__commission = 0
def set_weekly_sales(self, weekly_sales):
self.__weekly_sales = weekly_sales
def get_weekly_sales(self):
return self.__weekly_sales
def set_commission(self, commission):
self.__commission = commission
def get_commission(self):
return self.__commission
def calc_pay(self):
return Employee.calc_pay(self) + (self.__weekly_sales * self.__commission)
def __str__(self):
print()
string2 = 'Salesperson data: ' + '\n' + 'Employee name: ' + salesperson_name + '\n' + 'Employee hourly pay rate: ' + str(
salesperson_pay) + '\n' + 'Hours worked: ' + salesperson_hours + '\n' + 'Sales: ' + salesperson_sales + '\n' + 'Commission percentage: ' + str(
salesperson_commission) + '\n' + 'Pay: ' + str(salesperson_pay)
go_on = 'y'
while go_on == 'y':
input1 = input('Do you wish to enter data for an (E)mployee, a (S)alesperson, or would you like to (Q)uit?: ')
if input1 == 'e' or 'E':
employee_name = input('Enter the name of the employee: ')
employee_pay = input('Enter ' + employee_name + ' hourly pay rate: ')
employee_hours = input('Enter the number of hours worked by ' + employee_name + ': ')
employee_pay_rate = employee_pay * int(employee_hours)
employee = Employee(employee_name, employee_pay, employee_hours, employee_pay_rate)
print(employee)
if input1 == 's' or 'S':
salesperson_name = input('Enter the name of the employee: ')
salesperson_pay = float(input('Enter ' + salesperson_name + ' hourly pay rate: '))
salesperson_hours = input('Enter the number of hours worked by ' + salesperson_name + ': ')
salesperson_sales = input('Enter the amount of sales made by ' + salesperson_name + ': ')
salesperson_commission = float(input('Enter the commission percentage that will be earned by ' + salesperson_name + ': '))
salesperson = Salesman(salesperson_pay, salesperson_hours, salesperson_sales, salesperson_commission)
print(salesperson)
else:
go_on = 'n'
I am sure I got mostly everything right but I'm running into a couple problems and I don't know how to fix them.

Error: you are passing 5 arguments in the while loop to Employee with self included.
When taking input as a string from the user, use raw_input instead
of input.
input1 == "e" or "E" is always true. Do input1 == "e" or input1 == "E"
This way you are making use of the while loop to add as many users as needed.
And also some additional points:
You have a base class Employee whose constructor or init accepts (self, hours_worked, hourly_rate)
recommended: (self, name, hours_worked, hourly_rate)
In class Salesman's __init__ method, try to maintain the order of arguments passed where the parent class Employees arguments come first.
recommended: `class Salesman(Employee):
def __init__(self, name, hours_worked, hourly rate, weekly_sales, commission):
Employee.__init__(self, name, hours_worked, hourly_rate)
self.__weekly_sales = 0
self.__commission = 0`

Related

Python: Adding objects to a list using Classes

I am new to Classes and hope someone can help me out. I am writing av program where a user can add cars to an existing list of cars. The code I have so far is below. I am probably doing several mistakes here, but the error message I get now is "NameError: name 'car' is not defined". I think I am using the Car Class / Vehicle Class wrong. Anybody got any ideas how I can get on track with this?
class Vehicle:
def __init__(self, Make, Model, Year, Mileage, Price):
self.Makename = Make
self.Modelname = Model
self.Yearr = Year
self.Mileagenw = Mileage
self.Pricenw = Price
def getValus(self):
return self.Makename + " " + self.Modelname+ " " + self.Yearr+" " + self.Mileagenw+" " + self.Pricenw
def Display(self):
print("Invetory Unit: Car \n Make: "+ self.Makename + "\n Model: " + self.Modelname+ "\n Year " + self.Yearr+"\n Miles " + self.Mileagenw+" \n Price :" + self.Pricenw)
class Car(Vehicle):
def __init__(self, Make, Model,Year,Mileage,Price,numofdoors):
Vehicle.__init__(self,Make, Model,Year,Mileage,Price)
self.numofdoorsnw = numofdoors
def GetCar(self):
return self.getValus() + ", " + self.numofdoorsnw
def Display(self):
print("Invetory Unit: Car \n Make: "+ self.Makename + "\n Model: " + self.Modelname+ "\n Year " + self.Yearr+"\n Miles " + self.Mileagenw+" \n Price :" + self.Pricenw+" \n Number of doors :" + self.numofdoorsnw)
def main():
vehicles_list = []
vehicles_list += [Car("Tesla", "S", "2020", "170000", "33000.0", "4")]
vehicles_list += [Car("Tesla", "X", "2021", "180000", "23000.0", "4")]
newCar = "Y"
while newCar == "Y":
print('Input car data')
Make = input('Merke: ')
Model = input('Model: ')
Year = input('Year: ')
Milage = input('Milage: ')
Price = input('Price: ')
numofdoors = input('Number of Doors: ')
vehicles_list += [Car(Make, Model, Year, Milage, Price, numofdoors)]
newCar = input('Add another car? (Y/N) ')
print(car.getValus())
main()
class Vehicle:
def __init__(self, Make, Model, Year, Mileage, Price):
# are you making names unique here? if so, they are in a different namespace so don't have to be different
self.Makename = Make
self.Modelname = Model
self.Yearr = Year
self.Mileagenw = Mileage
self.Pricenw = Price
def getValus(self):
return self.Makename + " " + self.Modelname+ " " + self.Yearr+" " + self.Mileagenw+" " + self.Pricenw
def Display(self):
print("Invetory Unit: Car \n Make: "+ self.Makename + "\n Model: " + self.Modelname+ "\n Year " + self.Yearr+"\n Miles " + self.Mileagenw+" \n Price :" + self.Pricenw)
class Car(Vehicle):
def __init__(self, Make, Model,Year,Mileage,Price,numofdoors):
Vehicle.__init__(self,Make, Model,Year,Mileage,Price)
self.numofdoorsnw = numofdoors
def GetCar(self):
return self.getValus() + ", " + self.numofdoorsnw
def Display(self):
print("Invetory Unit: Car \n Make: "+ self.Makename + "\n Model: " + self.Modelname+ "\n Year " + self.Yearr+"\n Miles " + self.Mileagenw+" \n Price :" + self.Pricenw+" \n Number of doors :" + self.numofdoorsnw)
def main():
# adding unnamed instances of the class Car to a list. Each Car object is an element of the list
vehicles_list = []
vehicles_list += [Car("Tesla", "S", "2020", "170000", "33000.0", "4")]
vehicles_list += [Car("Tesla", "X", "2021", "180000", "23000.0", "4")]
newCar = "Y"
while newCar == "Y":
print('Input car data')
Make = input('Merke: ')
Model = input('Model: ')
Year = input('Year: ')
Milage = input('Milage: ')
Price = input('Price: ')
numofdoors = input('Number of Doors: ')
vehicles_list += [Car(Make, Model, Year, Milage, Price, numofdoors)]
newCar = input('Add another car? (Y/N) ')
print(car.getValus()) # car is undefined. print the vehicles_list instead, it contains all Car objects you have made.
main()
Improved version:
class Vehicle:
def __init__(self, make, model, year, mileage, price):
self.make = make
self.model = model
self.year = year
self.mileage = mileage
self.price = price
def getValues(self):
return self.make + " " + self.model + " " + self.year + " " + self.mileage + " " + self.price
def Display(self):
print("Invetory Unit: Car \n Make: " + self.make + "\n Model: " + self.model + "\n Year " + self.year + "\n Miles " + self.mileage + " \n Price :" + self.price)
class Car(Vehicle):
def __init__(self, Make, Model,Year,Mileage,Price,num_doors):
Vehicle.__init__(self,Make, Model,Year,Mileage,Price)
self.num_doors = num_doors
def GetCar(self):
return self.getValues() + ", " + self.num_doors
def Display(self):
print("Invetory Unit: Car \n Make: "+ self.make + "\n Model: " + self.model+ "\n Year " + self.year + "\n Miles " + self.mileage +" \n Price :" + self.price + " \n Number of doors :" + self.num_doors)
def main():
vehicles_list = []
vehicles_list.append(Car("Tesla", "S", "2020", "170000", "33000.0", "4"))
vehicles_list.append(Car("Tesla", "X", "2021", "180000", "23000.0", "4"))
newCar = "Y"
while newCar == "Y":
print('Input car data')
Make = input('Make: ')
Model = input('Model: ')
Year = input('Year: ')
Milage = input('Milage: ')
Price = input('Price: ')
numofdoors = input('Number of Doors: ')
vehicles_list.append(Car(Make, Model, Year, Milage, Price, numofdoors))
newCar = input('Add another car? (Y/N) ')
for car in vehicles_list:
print(car.GetCar())
main()
result:
Input car data
Make: VW
Model: Golf
Year: 2020
Milage: 10000
Price: 20000
Number of Doors: 5
Add another car? (Y/N) n
Tesla S 2020 170000 33000.0, 4
Tesla X 2021 180000 23000.0, 4
VW Golf 2020 10000 20000, 5
On the point about class namespaces, there is a great talk from Raymond Hettinger explaining those : https://www.youtube.com/watch?v=8moWQ1561FY
On print(car.getValus()), you want to get values from an object of class Car called car but you never defined this object. You probably want to modify your main in the following way
def main():
vehicles_list = []
vehicles_list += [Car("Tesla", "S", "2020", "170000", "33000.0", "4")]
vehicles_list += [Car("Tesla", "X", "2021", "180000", "23000.0", "4")]
newCar = "Y"
while newCar == "Y":
print('Input car data')
Make = input('Merke: ')
Model = input('Model: ')
Year = input('Year: ')
Milage = input('Milage: ')
Price = input('Price: ')
numofdoors = input('Number of Doors: ')
input_car = Car(Make, Model, Year, Milage, Price, numofdoors)
vehicles_list += [input_car]
newCar = input('Add another car? (Y/N) ')
for car in veichles_list:
print(car.getValus())

How do I sum given data in written file in python

My code runs almost correctly. The program needs to take in a country name, software/hardware/accessory sales, and then give the average for each category per country, total sales for each category, and overall total sales. If the users opt to enter a second, third, etc country, the averages and total must all be added together to find each calculation. My code currently calculates all of those things, but it does it for each country separately and it doesn't correctly count the number of countries added. I don't know why or how to fix it, please help!
def request_countryname():
country_name = input('Please enter the country\'s name: ')
while len(country_name) < 2:
print('Name must be at least two chracters')
country_name = input('Please enter the country\'s name: ')
return country_name
def request_sales(product_type, country_name):
sales = float(input('Please enter the total sales for ' + product_type + ' in ' + country_name + ": "))
while sales == type(str) or sales < 0:
print('Sales must be a non-negative numeric input')
sales = float(input('Please enter the total sales for', product_type, 'in', country_name))
return sales
def request_data(sales_data):
sales_data = open('sales_data.txt', 'w')
records = 0
add_country = True
while True:
records += 1
country_name = request_countryname()
soft_sales = request_sales('software', country_name)
hard_sales = request_sales('hardware', country_name)
acc_sales = request_sales('accessories', country_name)
sales_data.write(f'{country_name}\n{soft_sales}\n{hard_sales}\n{acc_sales}\n')
add_country = input('Do you want to add another country? (Enter y/Y for Yes, any other key to stop): ')
if add_country == 'y' or add_country == 'Y':
records += 1
request_data("sales_data.txt")
analyze_data("sales_data.txt")
else:
print(records, 'record(s) successfully added to the file.')
print('----------------------------------------------\n')
sales_data.close()
return sales_data
def analyze_data(sales_data):
sales_data = open ('sales_data.txt', 'r')
software_sales = []
hardware_sales = []
accessory_sales = []
read_file = sales_data.readline()
while read_file != '':
soft_sales = sales_data.readline()
hard_sales = sales_data.readline()
acc_sales = sales_data.readline()
software_sales.append(float(soft_sales))
hardware_sales.append(float(hard_sales))
accessory_sales.append(float(acc_sales))
read_file = sales_data.readline().rstrip('\n')
soft_average= sum(software_sales)/len(software_sales)
hard_average = sum(hardware_sales)/len(hardware_sales)
acc_average = sum(accessory_sales)/len(accessory_sales)
total_soft = sum(software_sales)
total_hard = sum(hardware_sales)
total_acc = sum(accessory_sales)
total_sales = float(total_soft + total_hard + total_acc)
print('Average software sales per country: $' + format(soft_average, ',.2f'))
print('Average hardware sales per country: $' + format(hard_average, ',.2f'))
print('Average accessory sales per country: $' + format(acc_average, ',.2f'))
print('')
print('Total software sales: $' + format(soft_average, ',.2f'))
print('Total hardware sales: $' + format(hard_average, ',.2f'))
print('Total accessory sales: $' + format(acc_average, ',.2f'))
print('')
print('Total sales: $' + format(total_sales, ',.2f'))
sales_data.close
def main():
request_data("sales_data.txt")
analyze_data("sales_data.txt")
main()
Edit: my professor said the problem was in the request_data function, specifically the "while True" part because I need to specify what is true, I just don't know what.
I'm going to try to answer your question, but also give you some refactoring pointers that may be helpful:
def request_country_name():
country_name = ""
while len(country_name) < 2:
print('Name must be at least two characters')
country_name = input('Please enter the country\'s name: ')
return country_name
def request_sales(product_type, country_name):
sales = ""
while sales == type(str) or sales < 0:
print('Sales must be a non-negative numeric input')
try:
sales = float(input(f"Please enter the total sales for {product_type} in {country_name}: "))
except:
pass
return sales
def read_record(record):
header = {'country_name': str,'soft_sales': float,'hard_sales': float,'acc_sales': float}
str_dict = dict(zip(list(header.keys()), record.replace("\n", "").split(",")))
return {k:header[k](v) for k,v in str_dict.items()}
def request_data(sales_data_file="sales_data.csv"):
records = 0
add_country = True
while True:
records += 1
country_name = request_country_name()
soft_sales = request_sales('software', country_name)
hard_sales = request_sales('hardware', country_name)
acc_sales = request_sales('accessories', country_name)
with open(sales_data_file, 'w') as writer:
writer.write(f'{country_name},{soft_sales},{hard_sales},{acc_sales}\n')
add_country = input('Do you want to add another country? (Enter y/n): ').upper()
if add_country == 'Y':
analyze_data(sales_data_file)
else:
print(F"{records} record(s) successfully added to the file.\n----------------------------------------------\n")
break
def analyze_data(sales_data_file="sales_data.csv"):
latest_country_records = {}
with open(sales_data_file) as reader:
for line in reader.readlines():
data = read_record(line)
latest_country_records[data['country']] = data
total_soft = sum([v['soft_sales'] for v in latest_country_records.values()])
soft_average= total_soft/len(latest_country_records)
total_hard = sum([v['hard_sales'] for v in latest_country_records.values()])
hard_average = total_hard/len(latest_country_records)
total_acc = sum([v['acc_sales'] for v in latest_country_records.values()])
acc_average = total_acc/len(latest_country_records)
total_sales = total_soft + total_hard + total_acc
print('Average software sales per country: $' + format(soft_average, ',.2f'))
print('Average hardware sales per country: $' + format(hard_average, ',.2f'))
print('Average accessory sales per country: $' + format(acc_average, ',.2f'))
print('')
print('Total software sales: $' + format(total_soft, ',.2f'))
print('Total hardware sales: $' + format(total_hard, ',.2f'))
print('Total accessory sales: $' + format(total_acc, ',.2f'))
print('')
print('Total sales: $' + format(total_sales, ',.2f'))
def main():
request_data("sales_data.txt")
analyze_data("sales_data.txt")
if __name__ == "__main__":
main()
Alright, so after some refactoring -- I think your biggest issue was you weren't handling the file handlers well (I replaced with context managers) which led to some odd structuring -- ie. your "request_data" function was being called recursively (by itself) in an unnecessary way.
Some other things to note, in your final print out you were printing the avg in place of the totals -- also you avg & total calculations overlapped a bit (reuse the total and calc it first).
Last note, and one worth keeping front of mind -- 9 times out of 10 there's an existing, established data structure -- lean on those. In this case, csv is your friend, in others json will be helpful.
Storing the data in different rows leads to unneeded complexity, and if possible should be avoided.
FWIW -- I haven't run/tested this code so there may be a few errors

Calculate the total of tickets and give a discount to student. There is a problem with function of the calculation the total and loops

Ticket sales. Calculate the total, based on the number of half price and full price tickets. If the user is a student, give a 50 cent discount for each ticket. Ask user to input number of child tickets, number of adult tickets, and if the person is a student (y/n). Keep asking until user enters a 0 and a 0
FULL_PRICE = 10.00
HALF_PRICE = FULL_PRICE % 2
giveDiscount = True
def calculatePrice(nHalfPriceTix, nFullPriceTix, giveDiscount):
if giveDiscount:
total = (nHalfPriceTix * HALF_PRICE) + (nFullPriceTix * FULL_PRICE) - .5
else:
total = (nHalfPriceTix * HALF_PRICE) + (nFullPriceTix * FULL_PRICE)
return total
while True:
print()
nChildTickets = input('How many child tickets do you want? ')
nChildTickets = int(nChildTickets)
nAdultTickets = input('How many adult tickets do you want? ')
nAdultTickets = int(nAdultTickets)
if (nChildTickets == 0) or (nAdultTickets == 0):
break
yesOrNo = input('Are you a student (y/n)? ')
if yesOrNo.lower() == 'y':
isStudent = True
else:
isStudent = False
thisTotal = calculatePrice(nChildTickets, nAdultTickets)
print('Your total is $' + thisTotal)
print()
totalSales = totalSales + thisTotal
print('Total of all sales $', totalSales)
Also to add on, this:
print('Your total is $' + thisTotal)
should be:
print('Your total is $' + str(thisTotal))
since the '+' operator in print() can only accept strings(not a float).
Or you could change the + to a ,.
calculatePrice function requires 3 arguments and got only two:
thisTotal = calculatePrice(nChildTickets, nAdultTickets)
so i think for that to work you need to pass isStudent because you didnt use it
thisTotal = calculatePrice(nChildTickets, nAdultTickets,isStudent)

Scope issue with nested functions

I get an unexpected indent error in def calculte_interest_on_savings(savings)? The variable savings got defined above on the exact same line...
def print_balance():
balance = 1000
print("Your balance is " + str(balance))
def deduct(amount):
print("Your new balance is " + str(balance - amount))
savings = balance-amount
deduct(500)
def calculte_interest_on_savings(savings):
print("You will gain interest on: " + str (savings))
calculte_interest_on_savings(savings)
print_balance()
I would write this way
def print_balance(balance):
print("Your balance is " + str(balance))
def deduct(amount,balance):
print("Your new balance is " + str(balance - amount))
savings = balance-amount
return savings
def calculte_interest_on_savings(savings):
print("You will gain interest on: " + str(savings))
balance = 1000
print_balance(balance)
savings=deduct(500,balance)
calculte_interest_on_savings(savings)
print_balance(balance)
There is no reason to nest these functions.
def print_balance():
balance = 1000
print("Your balance is " + str(balance))
savings = deduct(balance, 500)
calculate_interest_on_savings(savings)
def deduct(balance, amount):
print("Your new balance is " + str(balance - amount))
savings = balance - amount
return savings
def calculate_interest_on_savings(savings):
print("You will gain interest on: " + str(savings))
if __name__ == '__main__':
print_balance()

AttributeError: 'str' object has no attribute (function)

I'm trying to write an object-oriented program that allows me to enter and store monthly income and bills, and view all data as needed. I can successfully store an object, but when I try to use my view_all function, I get this error:
in view_all print(item.get_month())
AttributeError: 'str' object has no attribute 'get_month'
If you could help me track down this problem I'd be grateful!
# Create a month class
class Month:
# Use __init__ method to initialize the attributes
def __init__(self, month, income, tds, pnm, zia, water):
self.__month = month
self.__income = income
self.__tds = tds
self.__pnm = pnm
self.__zia = zia
self.__water = water
# The set methods accept arguments:
def set_month(self, month):
self.__month = month
def set_income(self, income):
self.__income = income
def set_tds(self, tds):
self.__tds = tds
def set_pnm(self, pnm):
self.__pnm = pnm
def set_zia(self, zia):
self.__zia = zia
def set_water(self, water):
self.__water = water
# The get methods return the data:
def get_month(self):
return self.__month
def get_income(self):
return self.__income
def get_tds(self):
return self.__tds
def get_pnm(self):
return self.__pnm
def get_zia(self):
return self.__zia
def get_water(self):
return self.__water
# The __str__ method return's the object's state as a string
def __str__(self):
return "Month: " + self.__month + \
"\nIncome: " + self.__income + \
"\nTDS: " + self.__tds + \
"\nPNM: " + self.__PNM + \
"\nZia: " + self.__zia + \
"\nWater: " + self.__water
And the main program:
import Month_Class
import pickle
ADD_MONTH = 1
VIEW_ALL = 2
QUIT = 3
FILENAME = 'ruidoso.dat'
def main():
months = load_months()
choice = 0
while choice != QUIT:
choice = get_menu_choice()
if choice == ADD_MONTH:
add_month(months)
elif choice == VIEW_ALL:
view_all(months)
save_months(months)
def load_months():
try:
input_file = open(FILENAME, 'rb')
months_dct = pickle.load(input_file)
input_file.close
except IOError:
month_dct = {}
return month_dct
def get_menu_choice():
print()
print('Menu')
print('------------------')
print("1. Add data for a new month")
print("2. View data for all months")
print('Any other number saves and quits the program!')
print()
choice = int(input('Enter your choice: '))
while choice < ADD_MONTH or choice > QUIT:
choice = int(input('Enter a valid choice: '))
return choice
def add_month(months):
month = input('Enter the name of the month: ')
income = input('Total income for this month: ')
tds = input('TDS Broadband bill total: ')
pnm = input('PNM bill total: ')
zia = input('Zia Natural Gas bill total: ')
water = input('City of Ruidoso bill total: ')
entry = Month_Class.Month(month, income, tds, pnm, zia, water)
if month not in months:
months[month] = entry
print('The entry has been added')
else:
print('That month already exists!')
def save_months(months):
output_file = open(FILENAME, 'wb')
pickle.dump(months, output_file)
output_file.close()
def view_all(months):
for item in months:
print(item.get_month())
print(item.get_income())
print(item.get_tds())
print(item.get_pnm())
print(item.get_zia())
print(item.get_water())
main()
You need to iterate over the dictionary differently
for month, item in months.items():
print(item.get_month())
...
In the view_all method, you must to iterate over dictionary:
for key, item in months.iteritems():
print(item.get_month())
and you got other error in __str__ method of Month class:
"\nPNM: " + self.__PNM + \
the correct is:
"\nPNM: " + self.__pnm + \

Categories