我試圖在列表中追加7個數字,並且每隔3個數字(從1開始)將其放回到列表中。出於某種原因,數字「1234567」正常工作和預期。但是,當使用數字'1324562'時,它將返回數字3'並返回IndexError。 代碼: number = "1324562"
digits = []
old_list = []
total = 0
for num in number:
num = i
我做了一個反轉函數,它顛倒了這個句子,但是它產生了索引錯誤。 該程序所做的是追加最後一個單詞並將其放入rev [], 然後刪除單詞s [-1]。 s = "This is awesome"
def Reverse1(s):
s = s.split(" ") #reverses the word instead of letters
rev = []
while True:
我在用下面的代碼的麻煩: from bokeh.plotting import figure, output_file, show, save
from bokeh.models import ColumnDataSource
from bokeh.models import Range1d, LinearAxis
import pandas as pd
from pandas impor