👍4
The filter() method filters the given sequence with the help of a function that tests each element in the sequence to be true or not.
Syntax :
filter(function, sequence)
Parameters: function: function that tests if each element of a sequence true or not. sequence: sequence which needs to be filtered, it can be sets, lists, tuples, or containers of any iterators.
Returns: returns an iterator that is already filtered
Syntax :
filter(function, sequence)
Parameters: function: function that tests if each element of a sequence true or not. sequence: sequence which needs to be filtered, it can be sets, lists, tuples, or containers of any iterators.
Returns: returns an iterator that is already filtered
👍2
Forwarded from PythonCoder Official
🌟𝗦𝗼𝘂𝗿𝗰𝗲 𝗖𝗼𝗱𝗲 💻👇 Of Rainbow Project 🌈
import turtle as t
import colorsys
t.speed(0)
t.hideturtle()
t.bgcolor("black")
t.title("Rainbow")
t.setup(700,700)
colors=49
radius=300
penwidth=20*7/colors
hue=0
def draw(x,y,r,pensize,color):
t.up()
t.goto(x+r,y)
t.down()
t.seth(90)
t.pensize(pensize)
t.pencolor(color)
t.circle(r,180)
for i in range(colors):
(r,g,b)=colorsys.hsv_to_rgb
(hue,1,1)
draw(0,-100,radius,penwidth,(r,g,b))
radius-=(penwidth-1)
hue+=0.9/colors
import colorsys
t.speed(0)
t.hideturtle()
t.bgcolor("black")
t.title("Rainbow")
t.setup(700,700)
colors=49
radius=300
penwidth=20*7/colors
hue=0
def draw(x,y,r,pensize,color):
t.up()
t.goto(x+r,y)
t.down()
t.seth(90)
t.pensize(pensize)
t.pencolor(color)
t.circle(r,180)
for i in range(colors):
(r,g,b)=colorsys.hsv_to_rgb
(hue,1,1)
draw(0,-100,radius,penwidth,(r,g,b))
radius-=(penwidth-1)
hue+=0.9/colors
👍3❤2🔥2👏1