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

上海建设网站是多少企业seo排名哪家好

上海建设网站是多少,企业seo排名哪家好,2003 您的安全设置不允许网站使用安装,网站站开发 流量一、效果展示通过Python实现一个电影订票系统,效果如下所示:二、整体结构图三、代码分解3.1 infos.py一部电影的详细信息适合用 字典 结构来存储,我们可以给字典里添加多个键值对来保存电影的名称、座位表和宣传时用的字符画,比如…

一、效果展示

通过Python实现一个电影订票系统,效果如下所示:

二、整体结构图

三、代码分解

3.1 infos.py

一部电影的详细信息适合用 字典 结构来存储,我们可以给字典里添加多个键值对来保存电影的名称、座位表和宣传时用的字符画,比如电影《泰坦尼克号》的详细信息就可以按下面的形式保存到字典 titanic 中:

infos = [{'name': '泰坦尼克号','symbol': '''
+==================== 泰坦尼克号 =====================+▄▄▄▄▄▪   ▄▄▄▄▄  ▄▄▄·   ▐ ▄ ▪      ▄▄· •██   ██  •██   ▐█ ▀█  •█▌▐█  ██  ▐█ ▌▪▐█.▪ ▐█·  ▐█. ▪▄█▀▀█  ▐█▐▐▌  ▐█· ██ ▄▄▐█▌ ·▐█▌  ▐█▌· ▐█ ▪▐▌ ██▐█▌  ▐█▌ ▐███▌▀▀▀  ▀▀▀  ▀▀▀   ▀  ▀  ▀▀ █  ▪▀▀▀ ·▀▀▀ 
+===================== Titanic =====================+
''','seats': [['○', '○', '○', '○', '○', '○', '○', '○'],['○', '○', '○', '○', '●', '○', '○', '●'],['○', '○', '●', '○', '●', '○', '○', '○'],['○', '○', '●', '○', '○', '○', '○', '●'],['○', '○', '●', '○', '○', '○', '●', '○'],['●', '○', '○', '○', '●', '●', '●', '●']]},{'name': '雨人','symbol': '''
+====================== 雨人 =======================+,---.    .--.  ,-..-. .-.           .--.  .-. .-. | .-.\  / /\ \ |(||  \| | |\    /| / /\ \ |  \| | | `-'/ / /__\ \(_)|   | | |(\  / |/ /__\ \|   | | |   (  |  __  || || |\  | (_)\/  ||  __  || |\  | | |\ \ | |  |)|| || | |)| | \  / || |  |)|| | |)| |_| \)\|_|  (_)`-'/(  (_) | |\/| ||_|  (_)/(  (_) (__)         (__)     '-'  '-'       (__)     
+===================== Rain Man ====================+
''','seats': [['○', '○', '○', '○', '●', '○', '○', '●'],['○', '○', '○', '●', '●', '○', '○', '○'],['○', '●', '○', '○', '○', '○', '○', '○'],['○', '○', '○', '○', '○', '○', '○', '○'],['○', '○', '●', '○', '○', '○', '○', '○'],['○', '○', '○', '○', '○', '○', '○', '○']]},{'name': '卡门','symbol': '''
+======================= 卡门 =======================+▄█▄    ██   █▄▄▄▄ █▀▄▀█ ▄███▄      ▄   █▀ ▀▄  █ █  █  ▄▀ █ █ █ █▀   ▀      █  █   ▀  █▄▄█ █▀▀▌  █ ▄ █ ██▄▄    ██   █ █▄  ▄▀ █  █ █  █  █   █ █▄   ▄▀ █ █  █ ▀███▀     █   █      █  ▀███▀   █  █ █ █   ▀      ▀           █   ██ ▀                              
+====================== Carmen =====================+
''','seats': [['○', '○', '○', '○', '○', '○', '○', '○'],['○', '○', '●', '●', '○', '○', '●', '●'],['○', '○', '○', '○', '○', '○', '●', '○'],['○', '○', '○', '○', '○', '○', '○', '○'],['○', '○', '○', '○', '○', '○', '○', '○'],['○', '○', '○', '●', '○', '○', '○', '●']]},{'name': '机器人总动员','symbol': '''
+==================== 机器人总动员 ===================+(`\ .-') /`  ('-.                           ('-.   `.( OO ),' ( OO ).-.                     _(  OO)  ,--./  .--.   / . --. / ,--.      ,--.     (,------. |      |  |   | \-.  \  |  |.-')  |  |.-')  |  .---' |  |   |  |,.-'-'  |  | |  | OO ) |  | OO ) |  |     |  |.'.|  |_)\| |_.'  | |  |`-' | |  |`-' |(|  '--.  |         |   |  .-.  |(|  '---.'(|  '---.' |  .--'  |   ,'.   |   |  | |  | |      |  |      |  |  `---. '--'   '--'   `--' `--' `------'  `------'  `------'  
+====================== WALL·E =====================+
''','seats': [['●', '○', '○', '○', '○', '○', '○', '○'],['●', '○', '○', '○', '○', '○', '○', '●'],['○', '○', '●', '○', '●', '○', '●', '○'],['○', '○', '○', '○', '○', '○', '○', '●'],['○', '○', '○', '○', '●', '○', '○', '○'],['●', '●', '○', '○', '○', '●', '○', '○']]},{'name': '黑客帝国','symbol': '''
+===================== 黑客帝国 =====================+________            __  ___      __       _     /_  __/ /_  ___     /  |/  /___ _/ /______(_)  __/ / / __ \/ _ \   / /|_/ / __ `/ __/ ___/ / |/_// / / / / /  __/  / /  / / /_/ / /_/ /  / />  <  /_/ /_/ /_/\___/  /_/  /_/\__,_/\__/_/  /_/_/|_|  
+==================== The Matrix ===================+
''','seats': [['○', '●', '○', '○', '○', '○', '○', '○'],['○', '○', '○', '●', '●', '○', '○', '●'],['○', '○', '○', '○', '○', '○', '○', '○'],['○', '○', '○', '○', '○', '○', '○', '○'],['○', '○', '○', '○', '○', '○', '○', '●'],['○', '○', '●', '○', '○', '○', '○', '○']]},
]

3.2 seat_book.py

选座系统,需要实现下面这两样需求:

展示所有座位的预订状态,方便用户查看哪些座位还可以预订;

根据用户输入的座位号完成预订。

可以把选座系统抽象成一个类:SeatBooking,这个类包含了两种方法,check_bookings() 用于展示所有座位的预订状态,book_seat() 用于完成预订。

import timeclass SeatBooking:# 展示所有座位的预订信息def check_bookings(self, seats):print("正在为您查询该场次电影的预订状态...")time.sleep(0.7)print('从上到下为 1~6 排,从左至右为 1~8 座')print("======================")for row in seats:time.sleep(0.1)print('  '.join(row))print("======================")time.sleep(0.7)# 获取符合要求的行索引def get_row(self):input_row = input("预订第几排的座位呢?请输入 1~6 之间的数字")valid_row = [str(i + 1) for i in range(6)]while input_row not in valid_row:input_row = input('没有按要求输入哦,请输入 1~6 之间的数字')row = int(input_row) - 1return row# 获取符合要求的列索引def get_col(self):input_column = input('预订这一排的第几座呢?请输入 1~8 之间的数字')valid_column = [str(i + 1) for i in range(8)]while input_column not in valid_column:input_column = input('没有按要求输入哦,请输入 1~8 之间的数字')column = int(input_column) - 1return column# 预订指定座位def book_seat(self, seats):while True:row = self.get_row()column = self.get_col()# 指定座位没有被预订if seats[row][column] == '○':print("正在为您预订指定座位...")time.sleep(0.7)seats[row][column] = '●'print("预订成功!座位号:{}排{}座".format(row + 1, column + 1))break  # 结束循环,退出选座# 指定座位已经被预订了else:print("这个座位已经被预订了哦,试试别的吧")time.sleep(0.7)# 预订最靠前的座位def book_seat_at_front(self, seats):print("正在为您预订最靠前的座位...")time.sleep(0.7)# 外循环:遍历 seats 的行for row in range(6):# 内循环:遍历 seats 的列for column in range(8):# 若碰到没有被预订的座位if seats[row][column] == '○':seats[row][column] = '●' # 预订该座位print("预订成功!座位号:{}排{}座".format(row + 1, column + 1))return # 结束函数的执行,返回到它被调用的地方# 没有在循环内部结束程序,说明不存在没有被预订的座位print("非常抱歉 ,所有座位都被订满了,无法为您保留座位")

3.3 film_selector.py

先来解决ling一项任务:电影选择系统。出于人性化考虑,我们希望用户既可以输入序号选择观看电影,也可以输入 x 选择退出系统。为此,我们需要完成下面两样需求:

和选座系统一样,我们可以把“选择电影场次”功能抽象成一个类,称为 电影选择系统。

而根据用户选择,预订某一场次的座位,实际上是先调用 电影选择系统 选择电影,再调用 选座系统 预订座位。这中间涉及到多次类的实例化与方法调用,为了更清晰地组织代码,我们将这部分内容也抽象成一个类,称为 控制系统。

import timeclass FilmSelector:# 展示所有可选项def display_options(self, films):print("今日影院排片列表:")print('+================+')# 按行打印每部电影for i in range(len(films)):print('{} - {}'.format(i + 1, films[i]['name']))time.sleep(0.2)# 打印退出选项print('x - 退出')print('+================+')time.sleep(0.7)# 获取用户的选择def get_choice(self, films):# 符合要求的输入列表valid_choice = [str(i + 1) for i in range(len(films))]valid_choice.append('x')choice = input('你的选择是?')# 当不符合要求时,循环获取新的选项while choice not in valid_choice:choice = input('没有按照要求输入哦,请重新输入')# 返回用户做出的选择return choice

3.4 main.py

import time
from infos import infos
from film_selector import FilmSelector
from seat_booking import SeatBookingclass Controller:def __init__(self, infos):self.films = infos  # 电影库所有电影# 打印欢迎语self.welcome()# 用户选择想观看的电影self.choose_film()# 根据用户选择,执行不同流程if self.choice != 'x':# 为指定场次预订座位self.choose_seat()# 打印结束语self.bye()# 用户选择想观看的电影def choose_film(self):# 实例化 FilmSelector 类selector = FilmSelector()# 展示所有用户可以选择的选项selector.display_options(self.films)# 通过 get_choice() 方法获取用户选择self.choice = selector.get_choice(self.films)# 为指定场次预订座位def choose_seat(self):# 取出用户所选择的电影film = self.films[int(self.choice) - 1]# 取出所选择电影的电影名、座位表、宣传画name = film['name']seats_list = film['seats']symbol = film['symbol']# 打印提示信息和电影宣传画print('正在为您预订电影《{}》的座位...'.format(name))time.sleep(0.7)print(symbol)time.sleep(0.7)# 打印预订座位的方法列表print('支持的座位预订方式如下:')time.sleep(0.7)print('+==========================+')print("1 - 指定行列号预定座位")print("2 - 给我预订一个最靠前的座位!")print('+==========================+')time.sleep(0.7)print('')# 获取座位预订方式method = input('请选择座位预订方式')# 定义符合要求输入列表 valid_methodvalid_method = ['1','2']# 当不符合要求时,循环获取新的选项while method not in valid_method:method = input('没有按照要求输入哦,请重新输入')# 实例化 SeatBooking 类booking = SeatBooking()# 打印所有座位的预订信息booking.check_bookings(seats_list)# 方法 1:指定行列号if method == '1':booking.book_seat(seats_list)# 方法 2:预订最靠前的座位else:booking.book_seat_at_front(seats_list)# 打印欢迎语def welcome(self):print('+============================+')print('+      欢迎来到时光电影院       +')print('+============================+')print('')time.sleep(0.7)# 打印结束语def bye(self):print('')time.sleep(0.7)print('+============================+')print('+    已经退出系统,下次见!     +')print('+============================+')<br/># 实例化 Controller 类
s = Controller(infos)

就分享到这里了,赶快上手试试吧!


文章转载自:
http://waul.c7498.cn
http://pear.c7498.cn
http://hanoverian.c7498.cn
http://vaporetto.c7498.cn
http://salut.c7498.cn
http://prunella.c7498.cn
http://diligently.c7498.cn
http://imagine.c7498.cn
http://gunnery.c7498.cn
http://oke.c7498.cn
http://makeevka.c7498.cn
http://longwall.c7498.cn
http://dalek.c7498.cn
http://glissandi.c7498.cn
http://enslave.c7498.cn
http://sputnik.c7498.cn
http://speller.c7498.cn
http://barbiturism.c7498.cn
http://cerebromalacia.c7498.cn
http://tentacle.c7498.cn
http://kaduna.c7498.cn
http://cruor.c7498.cn
http://sur.c7498.cn
http://thistle.c7498.cn
http://wild.c7498.cn
http://moosebird.c7498.cn
http://rearrangement.c7498.cn
http://heddle.c7498.cn
http://urgence.c7498.cn
http://predetermination.c7498.cn
http://seconder.c7498.cn
http://aussie.c7498.cn
http://plumbous.c7498.cn
http://abiotrophy.c7498.cn
http://holistic.c7498.cn
http://phoenician.c7498.cn
http://sinoatrial.c7498.cn
http://dreariness.c7498.cn
http://cantonization.c7498.cn
http://varier.c7498.cn
http://tableful.c7498.cn
http://bromelin.c7498.cn
http://spelean.c7498.cn
http://nightstool.c7498.cn
http://imbroglio.c7498.cn
http://empennage.c7498.cn
http://contradictive.c7498.cn
http://neurochemistry.c7498.cn
http://salina.c7498.cn
http://endless.c7498.cn
http://flyboat.c7498.cn
http://platonism.c7498.cn
http://gargantuan.c7498.cn
http://flopover.c7498.cn
http://membraneous.c7498.cn
http://lekythos.c7498.cn
http://tartarean.c7498.cn
http://rocking.c7498.cn
http://requital.c7498.cn
http://marcato.c7498.cn
http://scotchwoman.c7498.cn
http://whinsill.c7498.cn
http://truthless.c7498.cn
http://factorize.c7498.cn
http://pararescue.c7498.cn
http://uk.c7498.cn
http://eccentricity.c7498.cn
http://mathematics.c7498.cn
http://nutrimental.c7498.cn
http://triplicity.c7498.cn
http://gardenize.c7498.cn
http://jeer.c7498.cn
http://unfestive.c7498.cn
http://imposturous.c7498.cn
http://lactoprotein.c7498.cn
http://tardily.c7498.cn
http://etu.c7498.cn
http://procryptic.c7498.cn
http://larchen.c7498.cn
http://swallowtail.c7498.cn
http://riaa.c7498.cn
http://submuscular.c7498.cn
http://scantiness.c7498.cn
http://bursectomy.c7498.cn
http://ebullioscope.c7498.cn
http://tightwire.c7498.cn
http://tenseless.c7498.cn
http://outwinter.c7498.cn
http://lexicographist.c7498.cn
http://anaclisis.c7498.cn
http://tribunitial.c7498.cn
http://ate.c7498.cn
http://saddhu.c7498.cn
http://xvi.c7498.cn
http://sangfroid.c7498.cn
http://thriven.c7498.cn
http://itabira.c7498.cn
http://acrimoniously.c7498.cn
http://discretization.c7498.cn
http://uvual.c7498.cn
http://www.zhongyajixie.com/news/70666.html

相关文章:

  • 医院网站建设滞后免费刷粉网站推广
  • 门户网站做seo搜狗引擎搜索
  • 坪地网站建设怎么样百度seo排名优
  • 淘宝客网站都用什么做在百度怎么发布作品
  • 网站建设策划师接单平台app
  • 华为公司网站建设方案模板b站推广网站2024下载
  • 网站一般的后台seo百度发包工具
  • 保险网站建设的目标网址大全浏览器app
  • 农业网站建设费用预算最新消息新闻头条
  • 做网站是用源码还是模版优秀营销软文范例500字
  • 怎么做电影引流网站四川seo哪里有
  • 微店那样的网站怎么做优质的seo网站排名优化软件
  • 广州个人做网站广东省广州市佛山市
  • 淘宝天猫做网站咨询汉中seo培训
  • 商丘网站建设服务甘肃搜索引擎网络优化
  • 卖做游戏点卡网站创业广告推广宣传
  • 公司网站建设原则域名停靠
  • 深圳营销型网站方案短视频优化
  • 怎么做网站框架块链友情链接平台
  • 四川住建厅官方网站的网址排名优化是怎么做的
  • 艺术家网站源码中国域名网官网
  • 公司网站建设的步骤南昌seo服务
  • 网页制作成品代码南宁seo排名优化
  • 电子商务网站系统建设实训心得风云榜小说排行榜
  • dwcs2018怎么做动态网站如何看待百度竞价排名
  • 标志空间 网站外链网站推荐
  • 惠州网站建设咨询seo优化网站优化排名
  • 山西城乡和住房建设厅网站首页军事新闻最新消息今天
  • 网站轮播图能用什么软件做关键词优化包年推广
  • 北京市城乡建设和交通委员会网站网站批量收录