s = "Li20An24K04ao" ; i = 0
while i < len( s ) :
if "A" <= s[ i ] <= "Z" :
s = s[ : i ] + s[ i + 1 : ]
elif "0" <= s[ i ] <= "9" :
s = s[ : i ] + str( ( int(s[ i ]) + 8 ) % 10 ) + s[ i + 1 : ]
else :
s = s[ : i ] + chr( ( ord( s[ i ] ) – 95 ) % 26 + 97 ) + s[ i + 1 : ]
i = i + 1
执行上述程序后,s的值为( )
图a
为分析该年部分气温情况,编写 Python程序,请回答下列问题:
图b
实现该功能的程序如下,请在划线①处填入合适的代码。
划线②处应选填入的代码为(单选,填字母)。
A .df1 B .df1.values C .df1.index
import pandas as pd
df=pd.read_excel(" ① ")
df["日均温"]=(df["最高气温℃"]+df["最低气温℃"])/2
df1=df.sort_values("日均温",ascending=False).日均温.head(1)
Max= ②
date=[ ]
for i in range(len(df)):
if df.at[i,"日均温"]==Max:
date.append(df.at[i,"日期"])
print("日均温最高值:"Max,"℃")
print("日期:",date)
图c
df["月份"]=""
for j in range(len(df)):
df.at[j,"月份"]=df.at[j,"日期"][5:7]
df2=df.groupby("月份",as_index=True).③
plt.plot(④,df2["日均温"],label="月均温" )
plt.xlabel("月份")
plt.ylabel("温度℃")
plt.legend()
plt.show()