It says that I’m passing Show Answer 54d1cebed3292fa5fa00167e
points over 9 years Answer 54b3e4ad937676167f008039class Car(object): condition = “new” def init(self, model, color, mpg): self.model = model self.color = color self.mpg = mpg def display_car(self): return ‘this is a %s %s with %s MPG’ % (self.color, self.model, str(self.mpg))
points over 9 years Popular free courses
Free Course Learn HTMLStart at the beginning by learning HTML basics — an important foundation for building and editing web pages. At Career Karma, our mission is to empower users to make confident decisions by providing a trustworthy and free directory of bootcamps and career resources. We believe in transparency and want to ensure that our users are aware of how we generate revenue to support our platform. Career Karma recieves compensation from our bootcamp partners who are thoroughly vetted before being featured on our website. This commission is reinvested into growing the community to provide coaching at zero cost to their members. It is important to note that our partnership agreements have no influence on our reviews, recommendations, or the rankings of the programs and services we feature. We remain committed to delivering objective and unbiased information to our users. In our bootcamp directory, reviews are purely user-generated, based on the experiences and feedback shared by individuals who have attended the bootcamps. We believe that user-generated reviews offer valuable insights and diverse perspectives, helping our users make informed decisions about their educational and career journeys. Find the right bootcamp for you X By continuing you agree to our Terms of Service and Privacy Policy, and you consent to receive offers and opportunities from Career Karma by telephone, text message, and email. Hi all, Really sorry about the lack of code tags. I have them turned on in my account settings, but they're off for this post, and I can't see a button to change that. I saw a note in the forum documentation saying an administrator has to enable this. If there's a way for me to turn them on, let me know and I'll fix it. I hope my subject was descriptive enough. I am getting an error when calling a method in a class I made. The method has been defined as read_temp(self): but it still seems to think it should not take any arguments. My source code is this: Code:
The last part of the code, sensor_test() and esp_transmit(), is a means for me to test the temperature reading. If I hardcode a float into the esp_transmit call and have all this sending to a UDP server on my laptop, it works fine, but if I make the call to sensor.read_temp(), I don't see anything showing up at the server end. In the REPL, when I import this source file, and create a sensor object, as soon as I call read_temp(), I get TypeError: read_temp() takes 0 positional arguments but 1 were given The same goes if I call _read_sensor() directly. This error normally occurs if self has not been used as a parameter when defining the method. That is the only case I have seen online. I did also see that MicroPython has a problem with handling arguments sometimes: It made me think that there could be some issue with how micropython is handling my code. When I define all this code in the REPL myself, however, it works without a problem. I even got it to return some values from reading the sensors. So somehow it has an issue with this module. By the way, I'm using a pyboard, V1.1. tempobjects.py, the name of this module, is in the main directory for the board. boot.py contains the instruction, pyb.main('tempobjects.py') I'm all out of ideas. Is there something I'm missing about the way MicroPython handles classes? Thanks for your help. |