Feb-14-2020, 01:41 PM
Hello!
I've been working on this program and I don't know why, but there seems to be a problem with it...
2
5
0.0
25.0
50.0
75.0
100.0
6
12.3
-67.1
122.8
428.4
-15.9
221.0
But when I try to run the program, there is an error:
Traceback (most recent call last):
File "C:/Users/admin/Desktop/Collège Sainte Marcelline Prog (8)/Problème 05.py", line 10, in <module>
while(countSentence <= h[0]):
TypeError: 'type' object is not subscriptable
Anyone has got an idea?
I've been working on this program and I don't know why, but there seems to be a problem with it...
txt = "Prob05.in.txt" msg = open(txt, "r") msg = msg.read() h = msg.split("\n") h=int g = float first = True unSentence = 1 countSentence = 1 while(countSentence <= h[0]): while (unSentence <= g[0]): Sentence = '\n' seq = input (Sentence.format (unSentence)) print((g[i] - min(lst))/(max(lst) - min(lst))*255) unSentence += 1 countSentence += 1My file input is:
2
5
0.0
25.0
50.0
75.0
100.0
6
12.3
-67.1
122.8
428.4
-15.9
221.0
But when I try to run the program, there is an error:
Traceback (most recent call last):
File "C:/Users/admin/Desktop/Collège Sainte Marcelline Prog (8)/Problème 05.py", line 10, in <module>
while(countSentence <= h[0]):
TypeError: 'type' object is not subscriptable
Anyone has got an idea?