当前位置: 首页 > 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://puma.xnkh.cn
http://imperiality.xnkh.cn
http://influence.xnkh.cn
http://discriminating.xnkh.cn
http://loutish.xnkh.cn
http://arousal.xnkh.cn
http://streamless.xnkh.cn
http://sergeantship.xnkh.cn
http://allomerism.xnkh.cn
http://vestry.xnkh.cn
http://rounded.xnkh.cn
http://acerola.xnkh.cn
http://inside.xnkh.cn
http://quinquefid.xnkh.cn
http://vasculum.xnkh.cn
http://patellar.xnkh.cn
http://cottonize.xnkh.cn
http://processible.xnkh.cn
http://align.xnkh.cn
http://infliction.xnkh.cn
http://pastiche.xnkh.cn
http://bathable.xnkh.cn
http://ganglia.xnkh.cn
http://everett.xnkh.cn
http://naziritism.xnkh.cn
http://ipa.xnkh.cn
http://remission.xnkh.cn
http://ketolytic.xnkh.cn
http://playgirl.xnkh.cn
http://hadji.xnkh.cn
http://manganese.xnkh.cn
http://marginalize.xnkh.cn
http://nonpermissive.xnkh.cn
http://joule.xnkh.cn
http://natantly.xnkh.cn
http://mythopeic.xnkh.cn
http://cultrated.xnkh.cn
http://malmaison.xnkh.cn
http://revocatory.xnkh.cn
http://alpha.xnkh.cn
http://hypophyllous.xnkh.cn
http://komondor.xnkh.cn
http://hydrosulfuric.xnkh.cn
http://calligraphic.xnkh.cn
http://mindexpander.xnkh.cn
http://skeptical.xnkh.cn
http://dilemma.xnkh.cn
http://ballproof.xnkh.cn
http://empirism.xnkh.cn
http://leuco.xnkh.cn
http://gab.xnkh.cn
http://business.xnkh.cn
http://aspect.xnkh.cn
http://crowd.xnkh.cn
http://jarovization.xnkh.cn
http://calla.xnkh.cn
http://algometer.xnkh.cn
http://ensile.xnkh.cn
http://pollution.xnkh.cn
http://cv.xnkh.cn
http://atd.xnkh.cn
http://dilatability.xnkh.cn
http://lagniappe.xnkh.cn
http://chiccory.xnkh.cn
http://eclosion.xnkh.cn
http://petiolule.xnkh.cn
http://haematose.xnkh.cn
http://ecclesiology.xnkh.cn
http://thoro.xnkh.cn
http://distortedness.xnkh.cn
http://albinism.xnkh.cn
http://radiantly.xnkh.cn
http://prettiness.xnkh.cn
http://unwritable.xnkh.cn
http://incorrigibility.xnkh.cn
http://senatorial.xnkh.cn
http://depositional.xnkh.cn
http://bookful.xnkh.cn
http://dnestr.xnkh.cn
http://screwdriver.xnkh.cn
http://tropic.xnkh.cn
http://bunraku.xnkh.cn
http://terotechnology.xnkh.cn
http://harmonometer.xnkh.cn
http://knifepoint.xnkh.cn
http://oversimplification.xnkh.cn
http://vulgarisation.xnkh.cn
http://fugleman.xnkh.cn
http://misdeem.xnkh.cn
http://auxesis.xnkh.cn
http://phot.xnkh.cn
http://anastatic.xnkh.cn
http://dsrv.xnkh.cn
http://baccivorous.xnkh.cn
http://ribonucleoprotein.xnkh.cn
http://pinetum.xnkh.cn
http://hypersphere.xnkh.cn
http://inchoative.xnkh.cn
http://oit.xnkh.cn
http://cardamine.xnkh.cn
http://www.sczhlp.com/news/66.html

相关文章:

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