"""
Created on Sun Jun 28 17:18:32 2020
@author: han
"""
import numpy as np
reward_his=np.random.randint(1,10,10) #一个cpu周期的本地的能耗
tp=[0 for x in range(10)]
import matplotlib.pyplot as plt
k=0
for i in range(10):
# print(reward_his[i])
if (i > 2) and (i % 2 == 0):##脉冲可能就ius因为她
print(reward_his[i])
tp[k]=reward_his[i]
# tp[k].append(reward_his)
k+=1
a=tp[0:k]
import numpy as np
reward_his=np.random.randint(1,10,10)
#tp=[0 for x in range(10)]
tp=[]
import matplotlib.pyplot as plt
k=0
for i in range(10):
# print(reward_his[i])
if (i > 2) and (i % 2 == 0):
print(reward_his[i])
tp[k]=reward_his
小编我昨天彭搭配这么一个问题
然后将列表改为append加入元素也不对
正确的代码为
"""
Created on Sun Jun 28 17:18:32 2020
@author: han
"""
import numpy as np
reward_his=np.random.randint(1,10,10) #一个cpu周期的本地的能耗
tp=[0 for x in range(10)]
import matplotlib.pyplot as plt
k=0
for i in range(10):
# print(reward_his[i])
if (i > 2) and (i % 2 == 0):##脉冲可能就ius因为她
print(reward_his[i])
tp[k]=reward_his
这段代码也有问题
tp[k]=reward_his