热爱python,热爱生活,python需要浪漫,让我带大家走进浪漫的国度...写的不好的地方请大佬指教

import turtle
import time class Rose: def __init__(self):
self.interface() @classmethod
def interface(cls):
print('你喜欢玫瑰吗?')
lst = ['喜欢','不喜欢']
for index,hobby in enumerate (lst,1):
print(index,hobby)
while True:
try:
usr = int(input('请输入序号: ').strip())
if usr == 1:
print('你的选择是明智的')
cls.get_color()
break
else:
exit('再见')
except(ValueError,IndexError):
print('输入有误,请重新输入') @staticmethod
def get_rose(flower_color,leaf_color):
turtle.penup()
turtle.left(90)
turtle.fd(200)
turtle.pendown()
turtle.right(90)
turtle.fillcolor(flower_color)
turtle.begin_fill()
turtle.circle(10, 180)
turtle.circle(25, 110)
turtle.left(50)
turtle.circle(60, 45)
turtle.circle(20, 170)
turtle.right(24)
turtle.fd(30)
turtle.left(10)
turtle.circle(30, 110)
turtle.fd(20)
turtle.left(40)
turtle.circle(90, 70)
turtle.circle(30, 150)
turtle.right(30)
turtle.fd(15)
turtle.circle(80, 90)
turtle.left(15)
turtle.fd(45)
turtle.right(165)
turtle.fd(20)
turtle.left(155)
turtle.circle(150, 80)
turtle.left(50)
turtle.circle(150, 90)
turtle.end_fill()
turtle.left(150)
turtle.circle(-90, 70)
turtle.left(20)
turtle.circle(75, 105)
turtle.setheading(60)
turtle.circle(80, 98)
turtle.circle(-90, 40)
turtle.left(180)
turtle.circle(90, 40)
turtle.circle(-80, 98)
turtle.setheading(-83)
turtle.fd(30)
turtle.left(90)
turtle.fd(25)
turtle.left(45)
turtle.fillcolor(leaf_color)
turtle.begin_fill()
turtle.circle(-80, 90)
turtle.right(90)
turtle.circle(-80, 90)
turtle.end_fill()
turtle.right(135)
turtle.fd(60)
turtle.left(180)
turtle.fd(85)
turtle.left(90)
turtle.fd(80)
turtle.right(90)
turtle.right(45)
turtle.fillcolor(leaf_color)
turtle.begin_fill()
turtle.circle(80, 90)
turtle.left(90)
turtle.circle(80, 90)
turtle.end_fill()
turtle.left(135)
turtle.fd(60)
turtle.left(180)
turtle.fd(60)
turtle.right(90)
turtle.circle(200, 60)
turtle.done() @staticmethod
def choose_color(color_table):
while True:
try:
for index, color in enumerate(color_table, 1):
print(index, color)
Silly_guy = int(input('请输入序号: ').strip())
break
except (ValueError, IndexError):
print('你输入的有误,请重新输入')
return color_table[Silly_guy - 1] @classmethod
def get_color(cls):
print('欢迎来到选花环节')
time.sleep(1)
print('那就先选择花花的颜色吧')
bingo = cls.flower()
print(f'好了花花的颜色是{bingo}')
time.sleep(1)
print('请选择叶子的颜色')
yoyo = cls.flower()
print(f'叶子的颜色是{yoyo}')
print('快去看看吧')
cls.get_rose(bingo,yoyo) @classmethod
def flower(cls):
Bekir = 'green|red|pink|black|purple|yellow|cyan'
color_table = Bekir.split('|')
ret = cls.choose_color(color_table)
return ret Rose()

python-Beautiful rose的更多相关文章

  1. 推荐一些python Beautiful Soup学习网址

    前言:这几天忙着写分析报告,实在没精力去研究django,虽然抽时间去看了几遍中文文档,还是等实际实践后写几篇操作文章吧! 正文:以下是本人前段时间学习bs4库找的一些网址,在学习的可以参考下,有点多 ...

  2. Python Beautiful Soup学习之HTML标签补全功能

    Beautiful Soup是一个非常流行的Python模块.该模块可以解析网页,并提供定位内容的便捷接口. 使用下面两个命令安装: pip install beautifulsoup4 或者 sud ...

  3. python beautiful soup库的超详细用法

    原文地址https://blog.csdn.net/love666666shen/article/details/77512353 参考文章https://cuiqingcai.com/1319.ht ...

  4. Python Beautiful Soup 解析库的使用

    Beautiful Soup 借助网页的结构和属性等特性来解析网页,这样就可以省去复杂的正则表达式的编写. Beautiful Soup是Python的一个HTML或XML的解析库. 1.解析器 解析 ...

  5. python Beautiful Soup的使用

    上一节我们介绍了正则表达式,它的内容其实还是蛮多的,如果一个正则匹配稍有差池,那可能程序就处在永久的循环之中,而且有的小伙伴们也对写正则表 达式的写法用得不熟练,没关系,我们还有一个更强大的工具,叫B ...

  6. (17)python Beautiful Soup 4.6

    一.安装 1.登陆官网:https://www.crummy.com/software/BeautifulSoup/ 2.下载 3.解压 4.安装 cmd找到文件路径,运行 setup.py buil ...

  7. python beautiful soup

    官方文档:https://www.crummy.com/software/BeautifulSoup/bs4/doc.zh/ 使用前需要先安装模块,并安装解析器 pip install beautif ...

  8. Python Beautiful Soup 4

    Beautiful Soup 是一个灵活方便的网页解析库,利用它不用编写正则表达式即可方便地提取的网页信息 官方文档:https://www.crummy.com/software/Beautiful ...

  9. Python Beautiful Soup模块的安装

    以安装Beautifulsoup4为例: 1.到网站上下载:http://www.crummy.com/software/BeautifulSoup/bs4/download/ 2.解压文件到C:\P ...

  10. python Beautiful Soup库入门

    bs4库的HTML内容遍历方法 基于bs4库的HTML格式输出 显示:友好的显示 <tag>.prettify() 编码:bs4库将任何HTML输入都变成utf-8编码(python 3. ...

随机推荐

  1. javascript中的数据结构

    Javascript中的关键字   abstract     continue      finally      instanceof      private       this boolean ...

  2. Java定时任务示例

    package com.my.timer; import java.util.Date; import java.util.TimerTask; public class myTask extends ...

  3. Linux系统命令缩写

    命令缩写:(转) ls:list(列出目录内容) cd:Change Directory(改变目录) su:switch user 切换用户 rpm:redhat package manager 红帽 ...

  4. 译:6.RabbitMQ Java Client 之 Remote procedure call (RPC,远程过程调用)

    在  译:2. RabbitMQ 之Work Queues (工作队列)  我们学习了如何使用工作队列在多个工作人员之间分配耗时的任务. 但是如果我们需要在远程计算机上运行一个函数并等待结果呢?嗯,这 ...

  5. Atitit 计算word ppt文档的页数

    Atitit 计算word ppt文档的页数 http://localhost:8888/ http://git.oschina.net/attilax/ati_wordutil private vo ...

  6. List 比较大小

    List<Player> lst = new List<Player>(); lst.Add()); lst.Add()); lst.Add()); lst.Add()); l ...

  7. vue项目使用webpack loader把px转换为rem

    下载lib-flexible https://github.com/amfe/lib-flexible npm i lib-flexible --save 在main.js中引入lib-flexibl ...

  8. 推荐几个Windows工具软件: HDDB - Everything的替代品

    主页: http://hddb.xp-zed.com/index.html 简单地说,HDDB 是NTFS磁盘的文件搜索工具,它最开始是模仿 Everything 的,但解决了 Everything ...

  9. Java中内存溢出与内存泄露

    内存溢出 内存溢出(out of memory),是指程序在申请内存时,没有足够的内存空间供其使用,出现out of memory:比如申请了一个integer,但给他存了long才能存下的数,就会发 ...

  10. Android美丽的对话框项目sweet-alert-dialog

    美丽的对话框 sweet-alert-dialog 项目地址: https://github.com/pedant/sweet-alert-dialog android原生的dialog太生硬了,之前 ...