基礎(chǔ)
web
選擇題
1.在HTML上,將表單中INPUT元素的TYPE屬性設(shè)置為(A)時赞哗,用于創(chuàng)建重置按鈕
A:reset B:set
C:button D:image
2. 文件中用超級鏈接標(biāo)記指向一個目標(biāo)的基本格式為(C)
A:<a href="URL">
B:<href = "URL">字符串
C:<a href="URL">字符串</a>
D: <href = "URL">
3.關(guān)于HTML文件說法正確的是:(C)
A:HTML標(biāo)記都必須配對使用
B:在<title>和</title>標(biāo)簽之間的是頭信息
C:HTML標(biāo)簽是大小寫無關(guān)的廓译,<b>和<B>表示的意思是一樣的
D:在<u>和</u>標(biāo)簽之間的文本會以加粗字體顯示
4. 在HTML中DIV默認(rèn)樣式下是不帶滾動條的,若要使<div>標(biāo)簽出現(xiàn)滾動條捺癞,需要為該標(biāo)簽定義(C)
A:overflow:hidden距淫;
B:display:block;
C:overflow:scroll;
D:display:scroll;
5. 以下哪個技術(shù)不是Ajax技術(shù)體系的組成部分袖扛?(A)
A: XMLHttpRequest B: DHTML
C: CSS D: DOM
6.打開名為“Windows2”的新窗口JavaScript語法是申窘?(B)
A:open.new("http://www.zksoftware.com","windows2")
B:window.open("http://www.zksoftware.com","windows2")
C:new("http://www.zksoftware.com","windows2")
D:new.window("http://www.zksoftware.com","windows2
window對象中常用的屬性
location.href
location.hostname
location.pathname
location.port
location.protocol
history.back() - 與在瀏覽器點擊后退按鈕相同
history.forward() - 與在瀏覽器中點擊按鈕向前相同
寫出一個簡單的$.ajax()的請求方式
$.ajax({
type: "GET",
url: "test.json",
data:{a:100},
dataType: "json",
success: function(data){
if (data) {
conslog.log(data);
}
}
});
數(shù)據(jù)庫
1.用一個select語句輸出每個城市中距離市中心
大于20km酒店數(shù)
+----+-------+---------+-----------+
| id | name | city_id | distancel |
+----+-------+---------+-----------+
| 1 | a酒店 | 1000 | 8 |
| 2 | b酒店 | 1000 | 22 |
| 3 | c酒店 | 1000 | 35 |
| 4 | d酒店 | 10001 | 15 |
| 5 | e酒店 | 10001 | 26 |
+----+-------+---------+-----------+
2. 用一個select語句輸出每個城市中距離市中心大于20km酒店數(shù)?
select city_id,count(*) from hotels where distancel > 20 GROUP BY city_id;
+---------+----------+
| city_id | count(*) |
+---------+----------+
| 1000 | 2 |
| 10001 | 1 |
+---------+----------+
3. - 統(tǒng)計班級信息弯蚜,按性別分組,并統(tǒng)計每組人數(shù)剃法;
MySQL> select sex,count(*) from stu group by sex;
-- 統(tǒng)計每個班級的人數(shù)
MySQL> select classid,count(*) from stu group by classid;
-- 統(tǒng)計每個班級的碎捺,男生和女生各多少人數(shù)。
MySQL> select classid,sex,count(*) from stu group by classid,sex;
爬蟲
1. 請使用正則(regular expression module)模塊're'從一段中英文的字符串取得所有電話號碼贷洲,其中電話號碼可變收厨,s="This is our Chinese homepage.我們公司的客服電話:02-2511-6530.若要購買商品編號為:05-1423,請來電0928837577."
import re
s="This is our Chinese homepage.我們公司的客服電話:02-2511-6530.若要購買商品編號為:05-1423优构,請來電0928837577."
new_s = re.sub(r"-","",s)
phone_num_list = re.findall(r'\d{10}', new_s)
print(phone_num_list)
數(shù)據(jù)分析
1.一家超市的顧客數(shù)據(jù)诵叁,
將數(shù)據(jù)可視化并分析銷售額和年齡、收入的關(guān)系
并給出營銷建議
年齡 收入 銷售額
34 350 123
40 450 114
37 169 135
30 189 139
44 183 117
36 80 121
32 166 133
26 120 140
32 75 133
36 40 133
答案:
import matplotlib.pyplot as plt
# 年齡
age = [34,40,37,30,44,36,32,26,32,36]
# 收入
income = [350,450,169,189,183,80,166,120,75,40]
# 銷售額
sales = [123,114,135,139,117,121,133,140,133,133]
# 年齡钦椭,銷售額 散點圖
plt.scatter(age, sales)
plt.show()
# 收入拧额,銷售額 散點圖
plt.scatter(income, sales)
plt.show()
可視化結(jié)論:
顧客年齡和銷售額負(fù)相關(guān),年齡越大銷售額越低
顧客收入和銷售額也呈負(fù)相關(guān)玉凯,收入越高銷售額越低
建議:
營銷針對人群應(yīng)是一般收入100-200之間势腮,年齡20-37之間的人群联贩,這樣營銷效果更好
使用原生Python代碼和Numpy并行計算分別求解下面的y值
條件:
x1 = [1,2,3,4,5]
x2 = [3,5,2,9,10]
y = x12 + x23
求y值
原生Python實現(xiàn)
x1 = [1,2,3,4,5]
x2 = [3,5,2,9,10]
y = []
for i in range(len(x1)):
y.append(x1[i] ** 22222 + x2[i] ** 33333)
print(y)
Numpy實現(xiàn)
import numpy as np
x1 = np.array([1,2,3,4,5])
x2 = np.array([3,5,2,9,10])
y = x1 ** 22222 + x2 ** 33333
print(y)
返回下表中所有同學(xué)語文成績最低的1次考試成績
chinese english math name test
75 69 36 張三 一
68 85 87 李四 一
54 42 59 王五 一
55 57 63 李四 二
59 35 92 王五 二
45 63 92 王五 三
61 53 76 趙六 一
import pandas as pd
df = pd.read_table('5.class.csv', encoding='gbk’)
def top(x, n=1, column='chinese'):
return x.sort_values(by=column)[:1]
df.groupby('name').apply(top)
題目:創(chuàng)建三角級數(shù)類
閱讀下列代碼回答問題
import numpy as np
import matplotlib.pyplot as plt
class trigonometric_function:
tra_1=6
tra_2=12
def _init_(self,a,k,l):
self.const1=a
self.const2=k
self.const3=l
def Additive_term(self,x):
self.summand_s=np.sin(self.const2*x+self.tra_1)
self.summand_c=np.cos(self.const3*x+self.tra_2)
def trigon_sum(self,m,n):
sum_1=sum([sum([self.const1*(self.summand_s**i)*(self.summand_c**j) for i in range(m) ]) for j in range(n)])
return sum_1
def draw_pic(self,data):
fig,axes_1=plt.subplots(1,1,dpi=140,figsize=(8,6))
#x=np.linspace(-5,5,500)
axes_1.plot(x,data)
plt.show()
a.請在代碼中找出類變量漫仆、實例變量、方法泪幌、對象
#類變量:tra1,tra2,const1,const2,const3,summand_s,summand_c
#實例變量:x,a,k,l,m,n,data(通常前面沒有self.盲厌。)
#方法(屬性): Additive_term署照、trigonsum、drawpic
#對象:方法吗浩、類變量和實例變量
b.請寫出程序中所涉及到的三角級數(shù)
c.self 什么意思建芙?
self 代表類的實例,self 在定義類的方法時是必須有的懂扼,雖然在調(diào)用時不必傳入相應(yīng)的參數(shù)禁荸。
d.請闡述下列代碼運行后會有什么結(jié)果
f1=trigonometric_function()
#類的實例化
f1._init_(3,4,6)
#對類進行初始化
x=np.linspace(-5,5,500)
#生成500個-5到5之間的點
f1.Additive_term(x)
#生成普通三角函數(shù)sin和cos
data=f1.trigon_sum(4,5)
#生成三角級數(shù)數(shù)據(jù)
f1.draw_pic(data)
#繪圖