"int" object is not subscriptable
Publicado por Fabian Cano (1 intervención) el 05/03/2021 05:14:30
Tengo este codigo y cuando lo ejecuto me aparece el error
------------------------
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-19-6aff60753fc4> in <module>()
25 print("------------------------")
26
---> 27 print("Segunda Forma: ", 4 - 3[20 - 3 * 4 - (2 + 4)] / 2)
TypeError: 'int' object is not subscriptable
1
2
3
4
5
6
7
8
9
10
11
12
a = 4
b = 3
c = 20
d = 2
cuarto = a - b [c - b * a - (d + a) / d]
print("Primera Forma: ", cuarto, type(cuarto))
print("------------------------")
print("Segunda Forma: ", 4 - 3[20 - 3 * 4 - (2 + 4)] / 2)
------------------------
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-19-6aff60753fc4> in <module>()
25 print("------------------------")
26
---> 27 print("Segunda Forma: ", 4 - 3[20 - 3 * 4 - (2 + 4)] / 2)
TypeError: 'int' object is not subscriptable
Valora esta pregunta


0