首页 > > 详细

讲解 Investment Modeling Spring 2019, Practice Set # 1讲解 Python编程

Investment Modeling Spring 2019, Practice Set # 1

1. What is the tot?

x=c (1,5,6,3,2)

tot=10 *x - (2+x)

2. (Code) What is x?

x=c (55, seq (1,10,2),c (2,4,5))

3. (Code) What is a?

a=c (55, seq (1,10,2),c (2,4,5))

a[2]=3

a[8]=6

4. (Code) What is t?

b=1:5

t=0

for (i in b)

{

t=t+b

}

5. (Code) What is b?

b=c ()

a=1:5

for (x in a)

{

if (a[x]<3)

{

b[x]=a[x]+3

}

else

{

b[x]=a[x]-3

}

}

6. (Code) What is b?

b=c ()

a=1:5

for (x in a)

{

if (a[x]<3)

{

b[x]=a[x]+3

}

else

{

b[x]=a[x]-3

}

}

7. (Code) What is e?

a=2

b=4

c=3

p=1:4

e=p*a^2+p*b+p* (c-2)

8. (Code) What is c?

b=1:10

c=b[b<5]

9. (Code) What is c?

b=1:10

c=b[b>5 & b<=8]

10. You invested $100 in investment B for 2 years, and $100 in investment B for 1 year. Your rate of return for both years was exactly the same. If at the end of the 2 years the money grew to $215.25, what was your compound return?

11. You invested $100 in investment A, Year 1 it grew by 10%, Year 2 by -5%, Year 3 by 7%, and Year 4 by 9%  . What was the compound return for this investment?

12. What is A(2,6)?

 

A=function (x,y)

{

if (x*y>6)

{

return(B(x+1,y-1))

}

else

{

return(5*x-2*y)

}

}

B=function (a,b)

{

if (a+b>8)

{

return (a*b)

}

else

{

return (4*a-2*b)

}

}

 

 


联系我们
  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-21:00
  • 微信:codinghelp
热点标签

联系我们 - QQ: 99515681 微信:codinghelp
程序辅导网!