I have the following code:  import math inputs = input("").split() n = int(inputs[0]) r = float(inputs[1]) if n % 2 == 0 and r > 0:     output = (math.pi**(n/2) / math.gamma(n/2 + 1)) * (r**n)     print(output) else:     print("Conditions not met. Please ensure n is odd and r is greater than 0.") my problem is it works fine in jupyter notebook but nothing happens in spyder and I have no idea why, just as reference I have attached the assignment as image.

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter6: User-defined Functions
Section: Chapter Questions
Problem 22PE
icon
Related questions
Question

I have the following code: 

import math

inputs = input("").split()
n = int(inputs[0])
r = float(inputs[1])

if n % 2 == 0 and r > 0:
    output = (math.pi**(n/2) / math.gamma(n/2 + 1)) * (r**n)
    print(output)
else:
    print("Conditions not met. Please ensure n is odd and r is greater than 0.")

my problem is it works fine in jupyter notebook but nothing happens in spyder and I have no idea why, just as reference I have attached the assignment as image.

The volume of a sphere with radius r in n (with n even) dimensions is given by:
Vn(r):
=
(2)!
Write a function that given an n E N and r ER calculates the volume of the sphere. You
may assume that n is always an even number and that r > 0. Give your result with 2
decimals.
Input-Output specification
A single string composed of an integer and a float separated by a space
Transcribed Image Text:The volume of a sphere with radius r in n (with n even) dimensions is given by: Vn(r): = (2)! Write a function that given an n E N and r ER calculates the volume of the sphere. You may assume that n is always an even number and that r > 0. Give your result with 2 decimals. Input-Output specification A single string composed of an integer and a float separated by a space
Expert Solution
steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Arrays
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr