IndexError: Tuple index out of range of array in Python
Dung Do Tien
Jan 22 2021
277
I'm running my code in Python Ver3.9(Window10) and get the error status: tuple index out of range, here my code:
#!/usr/bin/python
country = ("VN", "USA", "CN")
count = 0
try:
if count <= len(country):
print(len(country))
print(country[count+3])
print("=================")
except IndexError as e:
print(e)
for countrya in range(0,len(country)):
print("=================")
print(country[0])
print(country[1])
print(country[2])
print("-----------------")
In my program, I have a lot of countries to call, I need a solution to solve it thoroughly on my computer and others too. Help me, many tks guys!
No answer found.
* Type maximum 2000 characters.
* All comments have to wait approved before display.
* Please polite comment and respect questions and answers of others.