Problem 45991. Find the position of planet in solarsystem
Write a funtion named nthplanet which takes name of the planet as input string and provides the position of the planet, starting from Mercury at 1st position and Neptune at 8th , as output.(For those who are sad because I ignored Pluto, Pluto is considered as Dwarf planet by IAU)
If
x = 'Earth'
then
nthplanet(x)
gives
3
Please have a look at the Testsuite before you begin
Solution Stats
Problem Comments
-
2 Comments
William
on 26 Jun 2020
Amar,
I think you have the order of the planets wrong in the test suite. Mars is #4, and #2 is Venus (which is missing from your list).
AMAR GAIKWAD
on 29 Jun 2020
Thanks william, edited it.
Solution Comments
Show commentsProblem Recent Solvers26
Suggested Problems
-
3711 Solvers
-
453 Solvers
-
Try 1.5.4: Celsius to Fahrenheit
831 Solvers
-
452 Solvers
-
Convert given decimal number to binary number.
2112 Solvers
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!