In [ ]:
import turtle as t
# Set up screen
t.bgcolor("lightblue")
t.speed(8)
# Draw face circle
t.penup()
t.goto(0, -150)
t.pendown()
t.color("gold")
t.begin_fill()
t.circle(150)
t.end_fill()
# Eyes
for x in [-60, 60]:
t.penup()
t.goto(x, 50)
t.pendown()
t.color("white")
t.begin_fill()
t.circle(30)
t.end_fill()
t.penup()
t.goto(x, 60)
t.pendown()
t.color("black")
t.begin_fill()
t.circle(15)
t.end_fill()
# Smile
t.penup()
t.goto(-70, -20)
t.pendown()
t.setheading(-60)
t.width(8)
t.color("black")
t.circle(80, 120)
# Cheeks
for x in [-90, 90]:
t.penup()
t.goto(x, -30)
t.pendown()
t.color("pink")
t.begin_fill()
t.circle(25)
t.end_fill()
# Hide turtle
t.hideturtle()
t.done()
In [1]:
import numpy as np
import matplotlib.pyplot as plt
#Define the Function
def f(x):
return x**2
def g(x):
return x**3
#Generate x values
x=np.linspace(-10, 10, 400) #400 points between -10 and 10
y=g(x)
plt.plot(x, y, label="g(x) = x3")
plt.xlabel ("x")
plt.ylabel ("f(x)")
plt.title("Plot of g(x)=x3")
plt.legend()
plt.grid(True)
plt.show()
In [2]:
import numpy as np
import matplotlib.pyplot as plt
# Define the Functions
def f(x):
return x**2
def g(x):
return x**3
# Generate x values
x = np.linspace(-10, 10, 400) # 400 points between -10 and 10
y1 = f(x)
y2 = g(x)
# Plot both functions
plt.plot(x, y1, label="f(x) = x²")
plt.plot(x, y2, label="g(x) = x³")
# Labels and title
plt.xlabel("x")
plt.ylabel("y")
plt.title("Plot of f(x)=x² and g(x)=x³")
plt.legend()
plt.grid(True)
plt.show()
In [ ]: