阿我是初學者
老師給了些作業
可是我實在不懂怎麼寫
想請大家幫幫我
幫我打出程式碼 和解釋一下好嗎 謝謝

1)
import my_utilities
k = my_utilities.invoke_at_line
listB=range(2); listB[0]=k; listB[1]=k;
a= listB[0](10, “test 0”); print type(a)
a= listB[1](10, “test 1”); print type(a)
用 for loop 改寫 3.1 (請注意傳入的字串 “test 0” 有變成 “test 1”)
2)
def my_problem4_1(a):
if a==1:
return "one"
elif a==2:
return "two"
elif a==3:
return "three"
else:
return "larger than three"
Q: 不要用 if-else statement, 改用 list 來達到相同的功能
我:
def my_problem4_1(a):
listA=['one','two','three','larger than three']
if a>4:
print listA[3]
else:
print listA[a-1]
可是這樣還是用到 if-else 怎麼樣可以直接用list達到相同功能??