import pandas as pd
# Step 1: Create a DataFrame
data = {
"Name": ["Mercury", "Venus", "Earth", "Mars", "Jupiter", "Saturn", "Uranus", "Neptune"],
"Diameter": ["4,879 km", "12,104 km", "12,742 km", "6,779 km", "139,822 km", "116,464 km", "50,724 km", "49,244 km"],
"Distance from Sun": [
"57,909,227 km", "108,209,475 km", "149,598,262 km", "227,943,824 km",
"778,340,821 km", "1,426,666,422 km", "2,870,658,186 km", "4,498,396,441 km"
],
"Length of Year": [
"88 Earth days", "225 Earth days", "365.24 days", "1.9 Earth years",
"11.9 Earth years", "29.5 Earth years", "84.0 Earth years", "164.8 Earth years"
]
}
df = pd.DataFrame(data)
# Step 2: Facts About Planets
print("___________________________________________________________")
print("FACTS ABOUT PLANETS\n")
print("There are 8 planets in our solar system, they are Mercury, Venus, Earth, Mars, Jupiter, Saturn, Uranus and Neptune.")
print("Planets in our solar system can be divided into two main groups, Terrestrial Planets and Gas Giants.")
print("Planets that orbit other stars are referred to as Exoplanets.")
print("___________________________________________________________\n")
# Step 3: Display numbered options
for i, name in enumerate(df["Name"]):
print(f"[{i}]-{name}", end=" ")
print()
# Step 4: Input prompt for selection
try:
choice = int(input("\nTo know see other details the planets,\ntype the letter assigned to each. >> "))
if 0 <= choice < len(df):
print("\nPlanet Details")
print("-" * 50)
print(df.iloc[choice])
print(f"Name: {choice}, dtype: object\n")
# Step 6: Conditional statements
if df.iloc[choice]["Name"] == "Jupiter":
print("Jupiter has more than double the mass of all the other planets combined.\n")
# Step 7: Ask to show more info
more = input("Do you want to know more about planets? Y/N >> ").lower()
if more == 'y':
print("\n" + "_" * 65)
print("Planets are among the many worlds and smaller objects that orbit the Sun.")
print("The formal definition of planet, as voted on by the International Astronomical Union in 2006, is as follows:")
print("A planet is a celestial body that")
print(" - is in orbit around the Sun")
print(" - has sufficient mass for its self-gravity to overcome rigid body forces so that it assumes a hydrostatic")
print(" equilibrium (nearly round) shape, and")
print(" - has cleared the neighbourhood around its orbit.\n")
# Step 8: Show full DataFrame
see_all = input("Do you want to see all planet details? Y/N >> ").lower()
if see_all == 'y':
print("\n", df.to_string(index=True))
else:
print("Invalid number. Please enter a number from 0 to 7.")
except ValueError:
print("Invalid input. Please enter a valid number.")
Benefits of CodeGroundAI Online IDE
Multi-Language Support
CodeGroundAI Online IDE supports C++, Java, Node.js, Python, and more, making it an incredibly versatile tool for diverse coding needs. This extensive language support allows developers to work on different projects within a single platform.
Real-Time Collaboration
Our real-time collaboration feature enables multiple developers to work on the same project simultaneously, enhancing teamwork and productivity. This feature is particularly beneficial for remote teams and pair programming sessions.
User-Friendly Interface
Designed with a clean and intuitive interface, CodeGroundAI Online IDE simplifies coding and debugging processes, making it accessible for users of all skill levels. The ease of use and clear navigation ensure a smooth coding experience.
Instant Code Execution
Experience fast and efficient code execution with immediate feedback in the integrated terminal. This feature helps streamline the development process, allowing developers to quickly test and debug their code.
Free to Use
Enjoy the full range of features at no cost. CodeGroundAI Online IDE is completely free, providing a valuable resource for developers without any subscription fees. This makes it an ideal choice for students, hobbyists, and professionals alike.
Cloud-Based Platform
As a cloud-based IDE, CodeGroundAI allows you to access your projects from anywhere, at any time. This flexibility ensures that you can continue coding without being tied to a specific device or location.
Customizable Environment
Tailor the IDE to your preferences with customizable themes, layouts, and extensions. This personalization ensures a comfortable and productive coding environment.
Why Choose CodeGroundAI Over Other Online IDEs?
CodeGroundAI Online IDE stands out from the competition with its comprehensive feature set, ease of use, and cost-effectiveness. Unlike many other online IDEs that require subscriptions or offer limited free plans, CodeGroundAI provides all its features for free. Our multi-language support, real-time collaboration, and advanced debugging tools ensure that you have everything you need for effective development. Additionally, our user-friendly interface and customizable environment make coding a pleasant experience, regardless of your expertise level. Choose CodeGroundAI Online IDE for a seamless, efficient, and enjoyable coding experience.