Bottom Page

• 0 Vote(s) - 0 Average
• 1
• 2
• 3
• 4
• 5
 Adding text to plot Pythcoronas Unladen Swallow Posts: 1 Threads: 1 Joined: Sep 2018 Reputation: 0 Likes received: 0 #1 Sep-11-2018, 01:27 PM 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)) turtle.circle® I'm still a newbie and I'm taking a class in Python for the first time. baby_quant Programmer named Tim Posts: 6 Threads: 0 Joined: Sep 2018 Reputation: 0 Likes received: 0 #2 Sep-13-2018, 12:27 PM (This post was last modified: Sep-13-2018, 12:28 PM by baby_quant. Edited 1 time in total.) Use something like this: ```import turtle # importing the module from math import pi radius=float(input("Enter radius of the circle: \n")) area=pi*(radius**2) trtl = turtle.Turtle() #making a turtle object of Turtle class for drawing trtl.pencolor('black') #making colour of the pen red trtl.speed(10) trtl.circle(radius) turtle.exitonclick()``` « Next Oldest | Next Newest »

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)