Python Issues swapping variables into a list -


this i'm assigned start filling list 10 random numbers. show list user. ask user pick 2 numbers between 1 , 10. swap elements in list in 2 list locations user used in #3 check see if list in order smallest largest. repeat steps 3 5 until done. thank user sorting list you.

ive gotten part of assigning user's input temporary box in list error

typeerror: 'type' object not subscriptable

and i'm stuck. i've searched around youtube , everywhere online , can't find assist me. heres code:

numbers = [4,2,5,5,6,4,7,6,9,5]  print("heres current list", numbers)  print("pick location between 1 , 10") num = int(input()) if num <= 10 , num >= 1:   print("please pick location between 1 , 10")   num1 = int(input())   temp1 = list[num-1]   temp2 = list[num1-1]   list[num-1] = temp2   list[num1-1] = temp1   print(list) 

the name of list numbers , not list. once make change, code work.


Comments