The Joy of Programming
Randomness
There is no preview available for this lesson. Please join the course to access it. Click here to enroll.
Questions
answer for 8.4
JE Joswin Emmanuel
3 years ago
Post
Dismiss
for i in range(1000): col=color(r=random(255),g=random(255),b=random(255),a=0.5) show(circle(random(-150,150),random(-150,150),random(-150,150),stroke=col))
for i in range(1000): col=color(r=random(255),g=random(255),b=random(255),a=0.5) show(circle(random(-150,150),random(-150,150),random(-150,150),stroke=col))
DP Dhanush P N
3 years ago
Post
Dismiss
##8.1 ```python def random_line(): return line(random(-150, 150), random(-150, 150), random(-150, 150), random(-150, 150)) for i in range(100): show(random_line()) ```
##8.1 ```python def random_line(): return line(random(-150, 150), random(-150, 150), random(-150, 150), random(-150, 150)) for i in range(100): show(random_line()) ```
DP Dhanush P N
3 years ago
Post
Dismiss
##8.2 ```python def random_color(): r = random(255) g = random(255) b = random(255) return color(r=r, g=g, b=b) def random_line(): return line(random(-150, 150), random(-150, 150), random(-150, 150), random(-150, 150), stroke=random_color()) for i in range(100): show(random_line()) ```
##8.2 ```python def random_color(): r = random(255) g = random(255) b = random(255) return color(r=r, g=g, b=b) def random_line(): return line(random(-150, 150), random(-150, 150), random(-150, 150), random(-150, 150), stroke=random_color()) for i in range(100): show(random_line()) ```
DP Dhanush P N
3 years ago
Post
Dismiss
##8.3 ```python def random_color(): r = random(255) g = random(255) b = random(255) return color(r=r, g=g, b=b, a=0.5) def random_line(): return line(random(-150, 150), random(-150, 150), random(-150, 150), random(-150, 150), stroke=random_color()) for i in range(1000): show(random_line()) ```
##8.3 ```python def random_color(): r = random(255) g = random(255) b = random(255) return color(r=r, g=g, b=b, a=0.5) def random_line(): return line(random(-150, 150), random(-150, 150), random(-150, 150), random(-150, 150), stroke=random_color()) for i in range(1000): show(random_line()) ```
DP Dhanush P N
3 years ago
Post
Dismiss
##8.4 ```python def random_color(): r = random(255) g = random(255) b = random(255) return color(r=r, g=g, b=b, a=0.5) def random_circle(): return circle(x=random(-150, 150), y=random(-150, 150), r=random(150), stroke=random_color()) for i in range(1000): show(random_circle()) ```
##8.4 ```python def random_color(): r = random(255) g = random(255) b = random(255) return color(r=r, g=g, b=b, a=0.5) def random_circle(): return circle(x=random(-150, 150), y=random(-150, 150), r=random(150), stroke=random_color()) for i in range(1000): show(random_circle()) ```
MS Muhammed Salih
3 years ago
Post
Dismiss
```py print("Hilow Hilow..") ```
```py print("Hilow Hilow..") ```
JB Jibin Babu Amakkattu
3 years ago
Post
Dismiss
print("arigatou gozaimas")
print("arigatou gozaimas")
Want to discuss?
Post it here, our mentors will help you out.
Answer for 8.3
JE Joswin Emmanuel
3 years ago
Post
Dismiss
for i in range(1000): col=color(r=random(255),g=random(255),b=random(255),a=0.5) show(line(random(-150,150),random(-150,150),random(-150,150),random(-150,150),stroke=col))
for i in range(1000): col=color(r=random(255),g=random(255),b=random(255),a=0.5) show(line(random(-150,150),random(-150,150),random(-150,150),random(-150,150),stroke=col))
MS Muhammed Salih
3 years ago
Post
Dismiss
``` print("Hilow Hilow") ```
``` print("Hilow Hilow") ```
Want to discuss?
Post it here, our mentors will help you out.