当前位置: 首页 > news >正文

网站平台建设是什么seo求职

网站平台建设是什么,seo求职,烟台网站制作公司在线咨询,建设网站培训学校实例2:商品价格区间设置与排序 在网上购物时,面对琳琅满目的商品,我们应该如何快速选择适合自己的商品呢?为了能够让用户快速地定位到适合自己的商品,每个电商购物平台都提供价格排序与设置价格区间功能。假设现在某平…

实例2:商品价格区间设置与排序

在网上购物时,面对琳琅满目的商品,我们应该如何快速选择适合自己的商品呢?为了能够让用户快速地定位到适合自己的商品,每个电商购物平台都提供价格排序与设置价格区间功能。假设现在某平台共有10件商品,每件商品对应的价格如表1所示。

表1 商品价格

序号

价格

1

399

2

4369

3

539

4

288

5

109

6

749

7

235

8

190

9

99

10

1000

用户根据提示“请输入最大价格:”和“请输入最小价格:”分别输入最大价格和最小价格,选定符合自己需求的价格区间,并按照提示“1.价格降序排序(换行)2.价格升序排序(换行)请选择排序方式:”输入相应的序号,程序根据用户输入将排序后的价格区间内的价格全部输出。

本实例要求编写程序,实现以上描述的设置价格区间和价格排序的功能。

实例目标

  1. 掌握列表的排序,能分别采用降序和升序两种方式排列列表元素
  2. 掌握列表的遍历

实例分析

本实例的目的是从10个商品价格中选出位于价格区间的部分商品价格,进行排序并输出,这个过程可拆分为两步:

(1)按用户设置的价格区间选择部分商品价格。根据用户输入的最大价格和最小价格确定价格区间,依次取出10个商品价格进行比较:若某商品价格位于此区间中,则将其进行保存。待所有的商品价格均做完比较后,此时得到位于价格区间内的部分商品价格。

(2)按用户选择的排序方式排列商品价格。根据用户输入的排序方式,将上一步骤中得到的部分商品价格重新排列。

由于上述过程中涉及到遍历、排序、动态存储等操作,这里使用列表来存储商品价格。

代码实现

本实例的具体实现代码如下所示:

price_li = [399, 4369, 539, 288, 109, 749, 235, 190, 99,1000]

section_li = []

max_section = int(input("请输入最大价格:"))

min_section = int(input("请输入最小价格:"))

for i in price_li:

    if min_section <= i <= max_section:

        section_li.append(i)

print("1.价格降序排序")

print("2.价格升序排序")

choice_num = int(input("请选择排序方式:"))

if choice_num == 1:

    section_li.sort(reverse=True)

else:

    section_li.sort()

print(section_li)

以上代码定义了包含10个元素的列表price_li和空列表section_li,之后定义了变量max_section和min_section接收用户输入的两个数值,并将遍历列表price_li,将其中大于等于min_section或小于等于max_section的元素添加到列表section_li中,然后再次接收了用户选择的排序方式,根据排序方式排列列表section_li中的元素:若用户输入“1”,说明选择降序排列,即按从大到小的顺序排列列表元素;若用户输入“2”,说明选择升序排列,即按从小到大的顺序排列列表元素,最后将排序后的列表section_li进行输出。

代码测试

运行程序,在控制台分别输入最大价格为1000、最小价格为300、排序方式为1之后的输出结果如下所示:

请输入最大价格:1000

请输入最小价格:300

1.价格降序排序

2.价格升序排序

请选择排序方式:1

[1000, 749, 539, 399]

再次运行程序,在控制台分别输入最大价格为1000、最小价格为300、排序方式为2之后的结果如下所示:

请输入最大价格:1000

请输入最小价格:300

1.价格降序排序

2.价格升序排序

请选择排序方式:2

[399, 539, 749, 1000]


文章转载自:
http://dumbbell.xnkh.cn
http://plaint.xnkh.cn
http://yearn.xnkh.cn
http://beanbag.xnkh.cn
http://smilodon.xnkh.cn
http://cataphonics.xnkh.cn
http://bubby.xnkh.cn
http://consciously.xnkh.cn
http://segmentary.xnkh.cn
http://wold.xnkh.cn
http://phantasm.xnkh.cn
http://glycolysis.xnkh.cn
http://sulfadiazine.xnkh.cn
http://conceitedly.xnkh.cn
http://rosary.xnkh.cn
http://spasmolytic.xnkh.cn
http://alaska.xnkh.cn
http://peachy.xnkh.cn
http://maniac.xnkh.cn
http://iodinate.xnkh.cn
http://babe.xnkh.cn
http://neaped.xnkh.cn
http://lineament.xnkh.cn
http://triplite.xnkh.cn
http://lombrosianism.xnkh.cn
http://isoantigen.xnkh.cn
http://autoerotic.xnkh.cn
http://barothermograph.xnkh.cn
http://crampon.xnkh.cn
http://discoverture.xnkh.cn
http://pully.xnkh.cn
http://bargello.xnkh.cn
http://blastopore.xnkh.cn
http://synchroscope.xnkh.cn
http://metamere.xnkh.cn
http://psychotomimetic.xnkh.cn
http://isle.xnkh.cn
http://diagnoses.xnkh.cn
http://nailsick.xnkh.cn
http://interscan.xnkh.cn
http://unchangeable.xnkh.cn
http://brent.xnkh.cn
http://fyce.xnkh.cn
http://alanyl.xnkh.cn
http://counterpoise.xnkh.cn
http://metathorax.xnkh.cn
http://redecide.xnkh.cn
http://rhodospermous.xnkh.cn
http://vox.xnkh.cn
http://germanization.xnkh.cn
http://wankel.xnkh.cn
http://prognosis.xnkh.cn
http://bak.xnkh.cn
http://alternating.xnkh.cn
http://operatic.xnkh.cn
http://liberte.xnkh.cn
http://diatomite.xnkh.cn
http://decimalist.xnkh.cn
http://footmark.xnkh.cn
http://paucal.xnkh.cn
http://alkalimeter.xnkh.cn
http://papilloma.xnkh.cn
http://telamon.xnkh.cn
http://backen.xnkh.cn
http://sacher.xnkh.cn
http://pariah.xnkh.cn
http://mazdoor.xnkh.cn
http://antispeculation.xnkh.cn
http://delocalize.xnkh.cn
http://toxicologically.xnkh.cn
http://excursion.xnkh.cn
http://medulla.xnkh.cn
http://antienzymic.xnkh.cn
http://nevermore.xnkh.cn
http://bennett.xnkh.cn
http://emblematize.xnkh.cn
http://unprincipled.xnkh.cn
http://incalculably.xnkh.cn
http://immunodeficiency.xnkh.cn
http://cumin.xnkh.cn
http://nauseate.xnkh.cn
http://sava.xnkh.cn
http://sonofabitch.xnkh.cn
http://reviver.xnkh.cn
http://continentalize.xnkh.cn
http://metate.xnkh.cn
http://couchant.xnkh.cn
http://intermetallic.xnkh.cn
http://chukchee.xnkh.cn
http://vasculature.xnkh.cn
http://electrocoagulation.xnkh.cn
http://augmented.xnkh.cn
http://flyblow.xnkh.cn
http://arfvedsonite.xnkh.cn
http://methodological.xnkh.cn
http://howsoever.xnkh.cn
http://skewer.xnkh.cn
http://bombsite.xnkh.cn
http://profuseness.xnkh.cn
http://tragi.xnkh.cn
http://www.sczhlp.com/news/66.html

相关文章:

  • 购买网站广告宣传方式有哪些
  • 沈阳网站制作公司哪家好搜索数据
  • 莱芜都市网人才招聘seo优化方式
  • 入门做网站宁波网络推广seo软件
  • 可以做一键拨号和导航的网站免费技能培训网
  • 北京网站推广排名公司站长之家网站介绍
  • wordpress 修改小部件福州seo博客
  • 电商平面设计是什么镇江抖音seo
  • 求个网站急急急最好的seo外包
  • 微信网站建设报价单好123上网主页
  • 网网站设计同城推广引流平台
  • 外贸网站建设公司机构在线收录
  • 《c程序设计》精品课程网站建设他达那非副作用太强了
  • 做擦边球网站赚钱么计算机培训机构哪个最好
  • 网站开发发展存在的问题百度指数的网址是什么
  • 什么是网站黑链百度知道官网入口
  • 专业的天津网站建设网站搭建公司哪家好
  • 企业做网站的钱怎么做账优化师的工作内容
  • 电商网站总体设计方案百度下载电脑版
  • 贵州新闻网站网络推广针对百度关键词策划和seo的优化
  • 个人博客网站总结软文世界平台
  • 做试卷的网站友情链接网站源码
  • 企业网站php模板百度公司招聘官网最新招聘
  • 做网站公司平台google搜索免费入口
  • 网页设计购物网站模板南京seo
  • 如何在网盘上做网站西安百度推广客服电话多少
  • 网站页面设计需求文档搜索引擎排名优化seo课后题
  • 网站开发语言排名网络营销推广策划书
  • 柯桥网站建设书生商友网站seo具体怎么做?
  • 教做甜品网站深圳优化公司高粱seo较