Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import turtle
- #puntoen(x,y) num num ->
- #la funcion toma dos puntos x,y y dibuja un punto en su lugar :D
- #puntoen(2,3) dibuja un punto en 2,3
- def puntoen(x,y):
- turtle.penup()
- turtle.setpos(x,y)
- turtle.pendown()
- return turtle.dot()
- import random
- #muchospuntos(n) num ->
- #la funcion toma n puntos y dibuja al azar en (x,y)
- #ejemplo muchospuntos tomara valores n en (x,y) al azar
- def muchospuntos(n):
- if n==0:
- return
- elif n>=1:
- x=random.uniform(-350,350)
- y=random.uniform(-350,350)
- puntoen(x,y)
- n=n-1
- return muchospuntos(n)
- n=input("¿cuantos puntos quiere dibujar? ")
- muchospuntos(n)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement