面試問(wèn)題
1、自我介紹
2、做功能測(cè)試和自動(dòng)化測(cè)試的占比 10
3、python基礎(chǔ) 如何對(duì)列表進(jìn)行去重處理。考察數(shù)據(jù)類(lèi)型 set(list1)
list1 = [1, 2, 6,3,5,5,8,8,9]
print(set(list1))
4、python基礎(chǔ) Python中常用的數(shù)據(jù)類(lèi)型有哪些
數(shù)字、布爾值、字符串、元組、列表、字典、集合
Numbers、Boolean、string、tuple、list、dictionaties、set
5、一個(gè)文本有大小寫(xiě),獲取大小寫(xiě)的數(shù)量。考察字符串操作
string1 = "abcvDdefaG"
num1 = 0
num2 = 0
# num1 大寫(xiě)數(shù)量 num2 小寫(xiě)數(shù)量
# 方法一:使用內(nèi)置函數(shù)
for ele in string1:
if ele.isupper():
num1 += 1
elif ele.islower():
num2 += 1
print("大寫(xiě)字母有%d個(gè),小寫(xiě)字母有%d個(gè)" % (num1, num2))
# 方法二:使用ASCII碼值來(lái)判斷字母大小寫(xiě)
# for letter in string1:
# if ord(letter) >= 65 and ord(letter) <= 90:
# num1 += 1
# elif ord(letter) >= 97 and ord(letter) <= 122:
# num2 += 1
# print("大寫(xiě)字母有%d個(gè),小寫(xiě)字母有%d個(gè)" % (num1, num2))
# 方法三:使用python中的字母表
# 定義字母表
# uppercase_letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
# lowercase_letters = "abcdefghijklmnopqrstuvwxyz"
# for ele in string1:
# if ele in uppercase_letters:
# num1 += 1
# elif ele in lowercase_letters:
# num2 += 1
# print("大寫(xiě)字母有%d個(gè),小寫(xiě)字母有%d個(gè)" % (num1, num2))
# 方法四:使用正則表達(dá)式
# 導(dǎo)入re模塊
# import re
# for letter in string1:
# if re.match(r'[A-Z]', letter):
# num1 += 1
# elif re.match(r'[a-z]', letter):
# num2 += 1
# print("大寫(xiě)字母有%d個(gè),小寫(xiě)字母有%d個(gè)" % (num1, num2))
6、字符串切割的關(guān)鍵字 split
7、獲取字典中所有的key和value值
# 獲取字典的key和value值
dict = {"a": 1, "b": 2}
# for key, v in dict.items():
# print("key={}".format(key))
# print("v={}".format(v))
# for item in dict.items():
# key = item[0]
# value = item[1]
# print(key, value)
for key in dict.keys():
print(key)
for value in dict.values():
print(value)
8、對(duì)Python遞歸算法怎么看
9、計(jì)算1-100偶數(shù)之和
sumEven = 0
for n in range(0, 101, 2):
print(n)
sumEven += n
print(sumEven)
10、Sql 訂單明細(xì)表orders,按各個(gè)月份month和各個(gè)車(chē)型carType的訂單數(shù)目
Select count() from orders group by month,cartype
Select cartype, sum(month) from orders group by month,cartype;
Select carType,
Sum(month(orderDate)=1 and year(orderDate)= 2023) as jan2023,
Sum(month(orderDate)=2 and year(orderDate)=2023) as feb2023,
Sum(month(orderDate)=3 and year(orderDate)=2023) as mar2023,
Sum(month(orderDate)=4 and year(orderDate)=2023) as apr2023,
Sum(month(orderDate)=5 and year(orderDate)=2023) as may2023,
Sum(month(orderDate)=6 and year(orderDate)=2023) as jun2023
From orders
Group by cartype
11、車(chē)型A的訂單表ordersA 車(chē)型B的訂單表ordersB,有銷(xiāo)售人員,查詢(xún)既賣(mài)了車(chē)型A又賣(mài)了車(chē)型B的所有銷(xiāo)售人員salesperson的名字,并按他們賣(mài)的車(chē)總數(shù)進(jìn)行降序排序
Select salesperson,count() from (select * from ordersA A left join on orderB B where A.salesperson = B.salesperson) order by count(*) desc;