How to make radius input automatically appear (Python 3) [closed] - python-3.x

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I'm trying to write a program that takes the input, radius given by the user.
For example:
If radius is 2.
I want the program to output:
"The volume of this sphere with radius 2 is: 33.51"
I have used the variable a to store the radius that the user inputs.
So far, I have printed
print("The volume of this sphere with radius a is:", ).
What am I missing?

You can use f-string for this:
print(f'The volume of this sphere with radius a is:{4*math.pi*a**3/3}')

Related

COLS vs getmaxx in ncurses [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
Tinkering with ncurses; can't seem to find why I would want to use getmaxyx() instead of LINES and COLS, or vice-versa.
It seems to me that LINES and COLS is already initialized by initscr(), so why would I want to go through the additional step of calling getmaxyx() and setting new variables?
LINES and COLS are the size of the screen, while getmaxyx gives the size of a window. curses applications can have several windows (and rarely more than one screen).

Seating arrangement problem in a circular table [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 months ago.
Improve this question
N people sit around a circular table. You have to find the probability that two particular people won't be sitting together.
The input will have the number N and the output should have the probability printed as a float type number rounded off to four decimal places.
Here's the link for the derived formula
You can find the step by step derivation over there
Here's the simple python implementation as per the thread
n = 5
result = (n-3)/(n-1)
print(result)
n= int(input())
import math
print(round(1-math.factorial(n-2)*math.factorial(2)/math.factorial(n-1),4))

how can I color the part in red using scilab and xfpoly [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
How can I color the part in red using scilab and xfpoly. Is there a way to color the calculated surface just after the integral between two bounds?
I suppose that your function is called with g(x) as in your previous post. The following should do what you want:
x=linspace(5,50,200);
plot(x,g(x))
deff('y=f(x,y0)','y=g(x)-y0')
x1 = fsolve(45,list(f,40))
x2 = fsolve(x1,list(f,30))
xv = linspace(x1,x2,1000);
yv = [40 g(xv) 30];
xv = [45 xv 45];
xfpoly(xv,yv,color('red'))

How to draw a kernel density plot using Haskell [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I have a set of timestamps (each corresponding to a student submission), and I wanted to take a look at them graphically. I know criterion uses a KDE and makes a nice plot, and it looks like it depends on the statistics package, which provides a kde function, but I couldn't trace through the code of criterion to see how it's being used.
Ideally, and answer would at least be a snippet of code that produces a picture. An explanation of what criterion does in this case would also be welcome.

Determining the maximum distance of two points in a list [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
I have a list of points (x/y each in one column) and need to determine the maximum distance of any combination of pairs of points.
I'm only interested in the distance not the pair of points itself.
Right now I use a rough upper boundary estimation by calculating the length of the vector
(max(x)-min(x), max(y)-min(y))
You could try using CTRL+SHIFT+ENTER:
=MAX((x-TRANSPOSE(x))^2+(y-TRANSPOSE(y))^2)^0.5
Also see: http://newtonexcelbach.wordpress.com/2010/11/27/maximum-distance-between-two-points/

Resources