一个列表的练习2

lianxi3.html

<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<link rel="stylesheet" type="text/css" href="../css/lianxi3.css"/>
	</head>
	<body>
		<div class="div1">
			<ul class="ul1">
				<li class="li0">保养心得<a href="#" class="i0">MORE+</a></li>
				<li class="li1"></li>
				<li class="li2"><i	 class="i1"></i><a href="#" class="a1">2016.03.11</a> <a href="#" class="a1">燃油粗滤器定期放水</a></li>
				<li class="li2"><i	 class="i1"></i><a href="#" class="a1">2016.03.22</a> <a href="#" class="a1">空气滤清器的使用与保养</a></li>
				<li class="li2"><i	 class="i1"></i><a href="#" class="a1">2016.03.22</a> <a href="#" class="a1">发动机皮带定期保养</a></li>
				<li class="li2"><i	 class="i1"></i><a href="#" class="a1">2016.03.22</a> <a href="#" class="a1">传送抽日常维护与保养</a></li>
				<li class="li2"><i	 class="i1"></i><a href="#" class="a1">2016.03.21</a> <a href="#" class="a1">出气筒定期检查防水</a></li>
				<li class="li2"><i	 class="i1"></i><a href="#" class="a1">2016.03.21</a> <a href="#" class="a1">鞍座的维护与保养</a></li>
				<li class="li2"><i	 class="i1"></i><a href="#" class="a1">2016.03.21</a> <a href="#" class="a1">鞍座的维护与保养</a></li>
				<li class="li2"><i	 class="i1"></i><a href="#" class="a1">2016.03.21</a> <a href="#" class="a1">鞍座的维护与保养</a></li>
				<li class="li2"><i	 class="i1"></i><a href="#" class="a1">2016.03.21</a> <a href="#" class="a1">鞍座的维护与保养</a></li>
				
				
			</ul>
		</div>
	</body>
</html>

lianxi3.css

@charset "utf-8";

.ul1{
	list-style: none;
}

.li0{
	height: 25px;
	width: 300px;
	border-bottom: 1px solid gainsboro;
	line-height: 23px;
	color: red;
}
.li1{
	width:300px ;
	height: 10px;
	
}
.li2{
	width:300px ;
	height: 35px;
	border-bottom: 1px solid gainsboro;
	line-height: 36px;
}
.i0{
	color:gainsboro;
	float: right;
	margin-top: 1px;
	text-decoration: none;
}
.i1{
	float: left;
	height: 34px;
	width: 1px;
	margin-top: -1px;
	background-color: white;
	border: 1px solid white;
}
.a1{
	text-decoration: none;
	color: black;
}

.li2:hover{
	background-color: beige;
}
.li2:hover .i1{
	background-color: red;
	border: 1px solid red;
}
.li2:hover .a1{
	color: red;
	text-decoration: underline;
}



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
1. 翻转列表 给定一个列表,将它翻转过来。例如: 输入: [1,2,3,4,5] 输出: [5,4,3,2,1] 解法: ```python def reverse_list(lst): return lst[::-1] ``` 2. 合并两个排序列表 给定两个已经排序的列表,将它们合并成一个排序列表。例如: 输入: nums1 = [1,2,3], nums2 = [2,5,6] 输出: [1,2,2,3,5,6] 解法: ```python def merge_lists(lst1, lst2): merged = [] i, j = 0, 0 while i < len(lst1) and j < len(lst2): if lst1[i] < lst2[j]: merged.append(lst1[i]) i += 1 else: merged.append(lst2[j]) j += 1 merged += lst1[i:] merged += lst2[j:] return merged ``` 3. 查找列表的最大值和最小值 给定一个列表,找到其的最大值和最小值。例如: 输入: [3, 5, 1, 8, 2] 输出: 最大值为8,最小值为1 解法: ```python def find_max_min(lst): if not lst: return None, None max_val = lst[0] min_val = lst[0] for val in lst: if val > max_val: max_val = val if val < min_val: min_val = val return max_val, min_val ``` 4. 列表去重 给定一个列表,将其的重复元素去掉。例如: 输入: [1,2,2,3,3,4,5,5] 输出: [1,2,3,4,5] 解法: ```python def remove_duplicates(lst): return list(set(lst)) ``` 5. 计算列表元素出现的次数 给定一个列表一个元素,计算这个元素在列表出现的次数。例如: 输入: [1,2,2,3,3,4,5,5], 2 输出: 2 解法: ```python def count_occurrences(lst, val): return lst.count(val) ``` 以上是一些常见的Python列表练习题,希望对你有帮助!
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值