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
  Adding Variable kevinwoo00 4 136 Feb-18-2019, 04:51 PM
Last Post: perfringo
  Help adding items to a glossary lga13 2 188 Jan-08-2019, 06:39 AM
Last Post: perfringo
  How do I make my plot show up? ThomasM4 0 208 Dec-09-2018, 05:28 AM
Last Post: ThomasM4
  Tips on surface plot HW question Cwcox 1 265 Nov-14-2018, 11:45 PM
Last Post: Larz60+
  How to customize x axis in matplotlib.pyplot for a scatter plot? wlsa 9 505 Nov-10-2018, 01:32 AM
Last Post: wlsa
  Adding values to list and pickling mefiak 2 451 May-31-2018, 08:57 AM
Last Post: mefiak
  plot the mean in a bar diagram sussii 3 464 May-23-2018, 11:27 PM
Last Post: wavic
  How to plot date series in matplotlib? StrybolData 2 1,928 Jan-25-2018, 07:13 PM
Last Post: StrybolData
  adding a number to the list atux_null 4 857 Nov-06-2017, 07:01 PM
Last Post: gruntfutuk
  text = str(text.encode('utf-8')) AttributeError: 'float' object has no attribute 'enc ulrich48155 2 2,986 Jul-31-2017, 05:21 PM
Last Post: ulrich48155

Forum Jump:

Users browsing this thread: 1 Guest(s)