Room design, we need to get Wednesday.
-
[grunting]
] There should be a programme that asks the user for the length and width of the wall, as well as a colour palette to be used to paint the wall. The wall needs to be painted with random colours from the colour palitre (coloured from the file) and randomly chosen figures. I wanted to use a turtle, but she's going abroad. Ideally, it should be done four times and then model the room. It's gonna be like this, but it's only supposed to paint in the rectangle.
from turtle import * from turtle import Screen from random import randint import random seinalaius=float(input("Введите длину стены (500-1500): ")) seinapikkus=float(input("Введите ширину стены (500-900): ")) värvipalett=input("Какую цветовую палитру вы хотите использовать? (Valik: mustvalge(чёрно-белый), roosa(розовый), punane(красный), lilla(фиолетовый), sinine(синий), kollane(жёлтый), roheline(зелёный), beež(бежевый), oranž(оранжевый)): ") fail=open(värvipalett + '.txt', encoding='UTF-8') värvid=[] for rida in fail: rida=rida.strip() värvid.append(rida) up() right(150) forward(900) down() left(150) for i in range(2): forward(seinalaius) left(90) forward(seinapikkus) left(90) import math up() left(30) a = math.sqrt((seinalaius**2) + (seinapikkus**2)) forward(a/2) down() while True: pöörded=randint(4,8) begin_fill() color(random.choice(värvid)) for i in range(pöörded): pikkus=randint(0,150) forward(pikkus) lr=randint(1,2) if lr==1: left(90) else: right(90) end_fill() up() down()
Example of blue file:
aliceblue aquamanne aquamarine1 aquamarine2 aquamarine3 aquamarine4 blue blue1 blue2 blue3 blue4 CadetBlue CadetBlue1 CadetBlue2 CadetBlue3 CadetBlue4 CornflowerBlue cyan cyan1 cyan2 cyan3 cyan4 DarkBlue DarkCyan DarkSlateBlue DarkSlateGray DarkSlateGray DarkSlateGray2 DarkSlateGray3 DarkSlateGray4 DarkSlateGrey DarkTurquoise DeepSkyBlue DeepSkyBlue2 DeepSkyBlue3 DeepSkyBlue4 DodgerBlue DodgerBlue1 DodgerBlue2 DodgerBlue3 DodgerBlue4 LightBlue LightBlue1 LightBlue2 LightBlue3 LightBlue4 LightSeaGreen LightSkyBlue LightSkyBlue1 LightSkyBlue2 LightSkyBlue3 LightSkyBlue4 LightSlateGray LightSlateGrey LightSteelBlue LightSteelBlue1 LightSteelBlue2 LightSteelBlue3 LightSteelBlue4 MediumAquamarine MediumBlue MediumSlateBlue MediumTurquoise midnightblue MidnightBlue navy NavyBlue PaleTurquoise PaleTurquoise1 PaleTurquoise2 PaleTurquoise3 PaleTurquoise4 PaleVioletRed PowderBlue RoyalBlue RoyalBlue1 RoyalBlue2 RoyalBlue3 RoyalBlue4 SkyBlue SkyBlue1 SkyBlue2 SkyBlue3 SkyBlue4 SlateGray SlateGray1 SlateGray2 SlateGray3 SlateGray4 SteelBlue SteelBlue1 SteelBlue2 SteelBlue3 SteelBlue4 turquoise turquoise1 turquoise2 turquoise3 turquoise4
-
from turtle import * from random import randint import random seinalaius = float(input("Введите длину стены (500-1500): ")) seinapikkus = float(input("Введите ширину стены (500-900): ")) värvipalett = input("Какую цветовую палитру вы хотите использовать? (Valik: mustvalge(чёрно-белый), roosa(розовый), punane(красный), lilla(фиолетовый), sinine(синий), kollane(жёлтый), roheline(зелёный), beež(бежевый), oranž(оранжевый)): ") fail = open(värvipalett + '.txt', encoding='UTF-8') värvid = [] for rida in fail: rida = rida.strip() värvid.append(rida) up() goto(-seinalaius / 2, -seinapikkus / 2) down() for i in range(2): forward(seinalaius) left(90) forward(seinapikkus) left(90) up() goto(0, 0) down() while True: pöörded = randint(4, 8) begin_fill() color(random.choice(värvid)) for i in range(pöörded): pikkus = randint(0, 150) up() forward(pikkus) if not -seinalaius / 2 <= xcor() <= seinalaius / 2 or not -seinapikkus / 2 <= ycor() <= seinapikkus / 2: backward(pikkus) backward(pikkus) down() forward(pikkus) lr = randint(1, 2) if lr == 1: left(90) else: right(90) end_fill() up() down()
result
and aquamanne was given a mistake, and after being removed from the file, it was checked in 10 minutes until it was irrigated.