POO error
Publicado por MAtias (3 intervenciones) el 24/04/2019 02:38:15
En un vivero se desea saber mediante los instrumentos instalados la humedad y la temperatura del ambiente.
codigo:
error:
Traceback (most recent call last):
File "poo.py", line 14, in <module>
medicion1.a()
AttributeError: Mediciones instance has no attribute 'a'
Llevo mucho tiempo y ya me dí por vencido.
codigo:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/usr/bin/python
#coding=utf-8
import sys
class Mediciones:
temperatura1 = "22ºC"
humedad1 = "33%"
def temperatura (self):
self.a = temperatura1
return a
def humedad (self):
self.b = humedad1
return b
medicion1 = Mediciones()
medicion1.a()
medicion1.b()
print medicion1.a
print medicion1.b
Traceback (most recent call last):
File "poo.py", line 14, in <module>
medicion1.a()
AttributeError: Mediciones instance has no attribute 'a'
Llevo mucho tiempo y ya me dí por vencido.
Valora esta pregunta


0