No one has voted on any posts yet. Votes from other community members are used to determine a member's reputation amongst their peers.
I have a subclass with 4 attributes and a subclass with 3 attributes. I want to store my subclass instances in a list. Can I have one list for both of them or do I have to create another list because the number of attributes is different? Thanks ! |
|
How do you call a method from the main() from a module to print base class attributes. Objects are contained in a list. Module [CODE] def show_employee(self): print 'Employee Name: ', self.__employee_name print 'Employee Number: ', self.__employee_number [/CODE] |
|
I would like to be able to display or print a count of the number of names that were inputted and display this when the user gets out of the loop by pressing any key other than "y". For example: Number of patients processed : 4 How could I create … |
|
Python 2.6.1: How would I write a user input validation statement scores < 0 or scores > 100 print error message and ask for input again? Where would I place it, in the below code? [CODE] num_test = raw_input("How many test would you like to average? ") scores = [] … |
|
When I run my program, I get the word None as output for a line. I don't have a print statement that contains that word. When I debug no errors found. Any ideas what it can be? |
|
I'm trying to restrict the users input to the selected characters only. "W" "w" or "L" "l" Anything else entered, an error message should display. Can anyone please look at this and tell me what I'm doing wrong? Thank you [CODE] # User Enters either W = Win and L … |
|
Can someone please look at my code and see if I'm writing it efficiently using parameters and return values. Thank you for your support [code] PAY_RATE = 12.75 #This program ask the user for: hours worked, then calculates gross pay. def get_hours(): hours = input("How many hours did you work?: … |
|
Where should your definitions of your functions be in your code? Should they be down below or above? What is the best way? Beginner Question - Thanks for your support. |