智慧家居报警系统由报警主机和各种探测器组成。探测器包括门磁、窗磁、煤气探测器、烟感探测器、红外探头等。若有特定情况便会触发相应的探测器,家庭报警主机会立即触发警铃,并将相关数据传送至小区管理中心,同时小区管理中心的报警主机将会记录下这些信息,并发送到用户指定的电话,以备查阅。
s = "A-b2c " ; ch = ""
list=[4 , 3 , 1 , 5 ,2]
for i in range(1en( s)):
if "A " <= s [i] <= "Z " :
ch = ch + chr (ord(s [i]) + list[i])
elif "a " <= s [i] <= "z " :
ch = ch + chr (ord(s [i]) - list[i])
else:
ch= s [i]+ch
print(ch)
该程序运行后,输出的结果是( )
n= 5
head=0
tail=4
que=['a' , 'b' ,'c' ,'d' ,'e' ]
while head!=tail:
if head%4==0:
print (que[head])
else:
tail=(tail+1)%n
que[tail]=que[head]
head= (head+1)%n
print (que[head])
def judge(a, b):
n=len(a) ;st=[- 1]*n
top-= 1; i=j=0
while i<n:
top+= 1
①
i+= 1
while top> - 1 and ② :
top-= 1
j+= 1
return top==- 1
from random import shuffle
a=[1,2,3,4, 5]
b=[1,2, 3, 4, 5]
shuffle (b) #将序列 b 的元素随机排序
if judge(a, b):
print (b,'是' ,a,' 的出栈序列')
else:
print (b,'不是' ,a,' 的出栈序列')
程序运行结果如图所示。划线处应填写的语句是( )
其中会员注册子页面如图b所示。存储会员信息的users表中共3个字段,依次保存序号、用户名和密码,如图c所示。会员注册时需满足以下条件:①用户名不重复;②密码长度大于5。服务器端部分代码如下。
from flask import Flask , render_template , request
import sqlite3
def check(name ,pwd):
conn= sqlite3 .connect( " account .db ")
cur=conn .cursor()
cur . execute( " select * from users where name= ’%s ’"%name)
val=cur .fetchall()
flag=True
if len(val)==0 and :
sql= "insert into users(name , password) values(' %s' , '%s ') "%(name , pwd)
cur .execute(sql)
conn .commit()
else:
flag=False
cur .close()
conn .close()
return flag
app=Flask(name_)
@app .route( "/reg ")
def reg() :
name=request . args .get( "xm ")
pwd=request .args .get( "psd ")
if :
return "注册成功! "
else:
return "请重新注册! "
#其它代码略
if _name_== "_main_ " :
app .run (host= " 192 . 168 . 1 . 10 " , port= 80 , debug=True)
图 a | 图 b |
请回答下列问题:
图 a | 图 b |