Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Adding text to plot
I am asked to plot a circle with user's input of radius, and display the area of the circle next to it on the plot. I know how to set up the whole thing but I don't know how to print on plot.
This is the code up till now:

import turtle
from math import pi
import math
r = float(input ("Input the radius of the circle : "))
print ("The area of the circle with radius " + str® + " is: " + str(pi * r**2))®

I'm still a newbie and I'm taking a class in Python for the first time.
Use something like this:

import turtle  # importing the module
from math import pi
radius=float(input("Enter radius of the circle: \n"))
trtl = turtle.Turtle()    #making a turtle object of Turtle class for drawing
trtl.pencolor('black')    #making colour of the pen red

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  matplotlib : Raster Plot adithyakrish 1 1,296 May-28-2019, 05:04 AM
Last Post: heiner55
  How to create a new plot in a figure right below the first one after click event? codexx 1 110 May-26-2019, 12:52 PM
Last Post: heiner55
  Plot a function dxfrelince 3 124 May-21-2019, 12:23 PM
Last Post: DeaD_EyE
  Split string into 160-character chunks while adding text to each part iambobbiekings 7 339 May-08-2019, 01:09 AM
Last Post: SheeppOSU
  Adding Variable kevinwoo00 4 271 Feb-18-2019, 04:51 PM
Last Post: perfringo
  Help adding items to a glossary lga13 2 298 Jan-08-2019, 06:39 AM
Last Post: perfringo
  How do I make my plot show up? ThomasM4 0 304 Dec-09-2018, 05:28 AM
Last Post: ThomasM4
  Tips on surface plot HW question Cwcox 1 370 Nov-14-2018, 11:45 PM
Last Post: Larz60+
  How to customize x axis in matplotlib.pyplot for a scatter plot? wlsa 9 850 Nov-10-2018, 01:32 AM
Last Post: wlsa
  Adding values to list and pickling mefiak 2 538 May-31-2018, 08:57 AM
Last Post: mefiak

Forum Jump:

Users browsing this thread: 1 Guest(s)