First you should know, that you'll not get 1 - Hello, 2 - World, .. if your str_list contains [1,4,..].
Another point is, that your lists should have the same amonut of entry , otherwise you could receive an indexerror.
To produce your excepted output, you could write:
str_list = [1, 4, 5, 6]
list_with_indexes = ["Hello", "World", "This", "Is"]
print("(orginal list is)" + str(str_list))
print ("List index-value are : ")
for i in range(len(str_list)):
print (str_list[i], '-', list_with_indexes[I])
that would return
(orginal list is)[1, 4, 5, 6]
List index-value are :
1 - Hello
4 - World
5 - This
6 - Is
______ EDIT ______
you could also just index over the list elements like
list_with_indexes = ["Hello", "World", "This", "Is"]
print ("List index-value are : ")
for i in range(len(list_with_indexes)):
print (i, '-', list_with_indexes[I])
gives you
1 - Hello
2 - World
3 - This
4 - Is
as python starts indexing with 0, you could write i+1 to start your output index with 1
print (i+1, '-', list_with_indexes[I])
to get
0 - Hello
1 - World
2 - This
3 - Is
(because you asked for that,) you could also define a function processing that piece of code for you:
def listIndexing(list):
print ("List index-value are : ")
for i in range(len(list)):
print (i, '-', list[i])
list_with_indexes = ["Hello", "World", "This", "Is"]
listIndexing(list = list_with_indexes)