热爱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. python2中在sqlite3中插入中文

    # -*- coding: utf-8 -*- import sqlite3 conn = sqlite3.connect('SWC_Perf_Info.db') cur = conn.cursor( ...

  2. 【PMP】合同类型

    合同类型与适用场景 图形解读: 总价类 (1)固定总价类合同:货物的采购价格在一开始就已确定,并且不允许改变(除非工作范围发生变更) (2)总价加激励费合同:同会设置价格上限,高于此价格的上限的全部成 ...

  3. 【Java】java数据库连接中C3P、DBCP、Druid连接池的使用

    使用JDBC的步骤:1.加载数据库驱动2.通过DriverManager获得数据库连接3.通过Connection获得Statement对象4.使用Statement执行SQL语句.5.操作结果集合6 ...

  4. pycharm启动慢 –xms -xmx相关参数设置

    Eclipse崩溃,错误提示:MyEclipse has detected that less than 5% of the 64MB of Perm Gen (Non-heap memory) sp ...

  5. 模仿ReentrantLock类自定义锁

    简介 临近过年了,没什么需求,今天模仿ReentrantLock自定义写了一个自己锁,在这里记录一下,前提是对AQS原理有所了解,分享给大家 1.自定义锁MyLock package com.jack ...

  6. django template if return false

    如果if的参数不存在于context中就会返回false 参考:http://stackoverflow.com/questions/11107028/django-template-if-true- ...

  7. React Native 进的第一个坑

    Bundling index.ios.js [development, non-minified, hmr disabled] 0.0% (0/1), failed. error: bundling ...

  8. Java知多少(7)类与对象

    Java是一门面向对象的编程语言,理解Java,首先要理解类与对象这两个概念. Java中的类可以看做C语言中结构体的升级版.结构体是一种构造数据类型,可以包含不同的成员(变量),每个成员的数据类型可 ...

  9. 假期小结 BIO, NIO, AIO

    虽然忙碌,但仍小有收获,开心. 引子 BIO: Blocking IO,阻塞式IO NIO: Non-blocking IO,非阻塞式IO AIO: Async IO,异步IO 问题 什么是阻塞式IO ...

  10. Python终端自动补全

    在-目录下添加一个文件,名字为.pythonstartup.py #!/usr/bin/python # -*- coding: UTF-8 -*- import readline, rlcomple ...