猫史档案馆


【Python作品分享】行星资料【作业帖】

用户:活泼的重金怪MO3m活泼的重金怪MO3m查看:0 回复:0 评论:0 创建时间:2020-02-23T18:27:07


【作品展示】

center_image

 

【作品介绍】

告诉你关于八大行星的知识

(需要帮助的话,在控制台内打help)

 

【作品源代码】

import time
import os


a = 'mercury'
b = 'venus'
c = 'earth'
d = 'moon'
f = 'sun'
g = 'mars'
h = 'phobos'
i = 'exit'
j = 'deimos'
k = 'saturn'
l = 'rhea'
m = 'titan'
n = 'jupiter'
o = 'lo'
p = 'callisto'
q = 'ariel'
r = 'umbriel'
s = 'titania'
t = 'oberon'
u = 'neptune'
v = 'triton'
w = 'nereid'
x = 'naiad'
y = 'proteus'
z = 'pluto'
print('PLANET DETAILS')
time.sleep(2)
print('BY ---')
time.sleep(1.5)
print('{MADE WITH PYTHON}')
time.sleep(2)
print('Loading...')
time.sleep(4)
enter = input('Enter planet name to see details:')
while True:
    if (enter != a and enter != b and enter != c and enter != d and enter != f and enter != g and enter != h and enter != i and enter != 'help' and enter != j and enter != k and enter != 'mimas' and enter != 'tethys' and enter != 'planet help' and enter != 'command help' and enter != 'dione' and enter != l and enter != m and enter != n and enter != o and enter != 'europa' and enter != 'ganymede' and enter != p and enter != 'uranus' and enter != q and enter != 'what can this program do' and enter != 'what can this program do?' and enter != 'what can you do' and enter != 'what can you do?' and enter != r and enter != s and enter != t and enter != u and enter != v and enter != w and enter != x and enter != y and enter != z and enter!="cls" and enter!="cmd"):
        print('Planet or command not found.')
        enter = input('Enter planet name to see details:')
    else:
        # ####Sun######
        if (enter == f):
            print('*The Sun is a star of the Solar System.')
            print('*It surrounds the Galaxy.')
            print('Diameter: 1392000 km')
            print('Rotation time needed: 25.05 d')
            print('Revolution time needed: 225000000 a / 250000000 a')
            print('Nearest distance to the Galaxy center: - l.y.')
            print('Farest distance to the Galaxy center: - l.y.')
            print('Planet:10 (found)')
            enter = input('Enter planet name to see details:')
        # ####Mercury#######
        if (enter == a):
            print('Diameter: 4878 km')
            print('Rotation time needed: 58.喵6 d')
            print('Revolution time needed: 87.9691 d')
            print('Nearest distance to the Sun: 46001200 km')
            print('Farest distance to the Sun: 69816900 km')
            print('Statellite:0')
            enter = input('Enter planet name to see details:')
        # ####Venus########
        if (enter == b):
            print('Diameter: 12103.6 km')
            print('Rotation time needed: 243 d')
            print('Revolution time needed: 224.7 d')
            print('Nearest distance to the Sun: 107476259 km')
            print('Farest distance to the Sun: 108942109 km')
            print('Statellite:0')
            enter = input('Enter planet name to see details:')
        # ####Earth#####
        if (enter == c):
            print('Diameter: 12756 km')
            print('Rotation time needed: 23 h 56 min 4 s (24 h)')
            print('Revolution time needed: 365.24219 d')
            print('Nearest distance to the Sun: 147098074 km')
            print('Farest distance to the Sun: 152097701 km')
            print('Statellite:1')
            enter = input('Enter planet name to see details:')
        # #####Moon#######
        if (enter == d):
            print('*Moon is a satellite of the Earth.')
            print('Diameter: 3476.28 km')
            print('Rotation time needed: 27.32 d (anti-clockwise, West to East)')
            print('Revolution time needed: 27.32 d')
            print('Nearest distance to the Earth: 363300 km')
            print('Farest distance to the Earth: 405493 km')
            enter = input('Enter planet name to see details:')
        # ####Mars#######
        if (enter == g):
            print('Diameter: 6794 km')
            print('Rotation time needed: 24.6229 h')
            print('Revolution time needed: 686.910 d')
            print('Nearest distance to the Sun: 206620000 km')
            print('Farest distance to the Sun: 249230000 km')
            print('Statellite:2')
            enter = input('Enter planet name to see details:')
        # ####Phobos######
        if (enter == h):
            print('*Phobos is a statellite of Mars.')
            print('*It is also named as [Mars I].')
            print('*It is the 喵allest statellite in the Solar System.')
            print('Diameter: - km')
            print('Rotation time needed: - h')
            print('Revolution time needed: about 8.5 h')
            print('Nearest distance to the Mars: about 6000 km')
            print('Farest distance to the Mars: about 6000 km')
            enter = input('Enter planet name to see details:')
        # ####exit program######
        if (enter == i):
            break
        # ####help########
        if (enter == 'help'):
            print('Planet name:')
            print('[sun]')
            print('[mercury]')
            print('[venus]')
            print('[earth]')
            print('[moon]')
            print('[mars]')
            print('[phobos]')
            print('[deimos]')
            print('[jupiter]')
            print('[lo]')
            print('[europa]')
            print('[ganymede]')
            print('[callisto]')
            print('[saturn]')
            print('[mimas]')
            print('[enceladus]')
            print('[tethys]')
            print('[dione]')
            print('[rhea]')
            print('[titan]')
            print('[uranus]')
            print('[ariel]')
            print('[umbriel]')
            print('[titania]')
            print('[oberon]')
            print('[neptune]')
            print('[triton]')
            print('[nereid]')
            print('[naiad]')
            print('[proteus]')
            print('[pluto]')
            print('Other commands:')
            print('[exit]')
            print('[help]')
            print('[planet help]')
            print('[command help]')
            print("[cls]")
            print("[cmd]")
            enter = input('Enter planet name to see details:')
        #####Deimos######
        if (enter == j):
            print('*Deimos is a statellite of Mars.')
            print('*It is also named as [Mars II].')
            print('Diameter: - km')
            print('Rotation time needed: - h')
            print('Revolution time needed: 30.3 h')
            print('Nearest distance to the Mars: about 23460 km')
            print('Farest distance to the Mars: about 23460 km')
            enter = input('Enter planet name to see details:')
        # ####Saturn######
        if (enter == k):
            print('Diameter: 120540 km')
            print('Rotation time needed: 10.546 h')
            print('Revolution time needed: 10832.327 d')
            print('Nearest distance to the Sun: 1353572956 km')
            print('Farest distance to the Sun: 1513325783 km')
            print('Statellite:82 (found)')
            enter = input('Enter planet name to see details:')
        # ####Mimas#####
        if (enter == 'mimas'):
            print('*Mimas is a statellite of Saturn.')
            print('*It is also named as [Saturn I].')
            print('Diameter: 397.2 km')
            print('Rotation time needed: - d')
            print('Revolution time needed: 22 h 37 min 5 s')
            print('Nearest distance to the Saturn: about 190000 km')
            print('Farest distance to the Saturn: about 190000 km')
            enter = input('Enter planet name to see details:')
        # ####Enceladus#####
        if (enter == 'enceladus'):
            print('*Enceladus is a statellite of Saturn.')
            print('*It is also named as [Saturn II].')
            print('Diameter: about 500 km')
            print('Rotation time needed: - d')
            print('Revolution time needed: - d')
            print('Nearest distance to the Saturn: about 238000 km')
            print('Farest distance to the Saturn: about 238000 km')
            enter = input('Enter planet name to see details:')
        # ####Tethys######
        if (enter == 'tethys'):
            print('*Tethys is a statellite of Saturn.')
            print('*It is also named as [Saturn III].')
            print('Diameter: 1062 km')
            print('Rotation time needed: - h')
            print('Revolution time needed: - d')
            print('Nearest distance to the Saturn: about 294600 km')
            print('Farest distance to the Saturn: about 294600 km')
            enter = input('Enter planet name to see details:')
        # ####planet help#####
        if (enter == 'planet help'):
            print('Planet name:')
            print('[sun]')
            print('[mercury]')
            print('[venus]')
            print('[earth]')
            print('[moon]')
            print('[mars]')
            print('[phobos]')
            print('[deimos]')
            print('[jupiter]')
            print('[lo]')
            print('[europa]')
            print('[ganymede]')
            print('[callisto]')
            print('[saturn]')
            print('[mimas]')
            print('[enceladus]')
            print('[tethys]')
            print('[dione]')
            print('[rhea]')
            print('[titan]')
            print('[uranus]')
            print('[ariel]')
            print('[umbriel]')
            print('[titania]')
            print('[oberon]')
            print('[neptune]')
            print('[triton]')
            print('[nereid]')
            print('[naiad]')
            print('[proteus]')
            print('[pluto]')
            enter = input('Enter planet name to see details:')
        # ####command help#####
        if (enter == 'command help'):
            print('Commands:')
            print('[exit]')
            print('[help]')
            print('[planet help]')
            print('[command help]')
            print("[cls]")
            print("[cmd]")
            enter = input('Enter planet name to see details:')
        # ####Dione#####
        if (enter == 'dione'):
            print('*Dione is a statellite of Saturn.')
            print('*It is also named as [Saturn IV].')
            print('Diameter: about 1120 km')
            print('Rotation time needed: 65 h 41 min')
            print('Revolution time needed: 65 h 41 min')
            print('Nearest distance to the Saturn: about 377000 km')
            print('Farest distance to the Saturn: about 377000 km')
            enter = input('Enter planet name to see details:')
        # ####Rhea#####
        if (enter == l):
            print('*Rhea is a statellite of Saturn.')
            print('*It is also named as [Saturn V].')
            print('Diameter: about 7喵.3 km')
            print('Rotation time needed: 4.518212 d')
            print('Revolution time needed: 4.518212 d')
            print('Nearest distance to the Saturn: about 500000 km')
            print('Farest distance to the Saturn: about 500000 km')
            enter = input('Enter planet name to see details:')
        # ####Titan#####
        if (enter == m):
            print('*Titan is a statellite of Saturn.')
            print('*It is also named as [Saturn VI].')
            print('Diameter: 5150 km')
            print('Rotation time needed: - d')
            print('Revolution time needed: 15 d 22 h 41 min 24 s')
            print('Nearest distance to the Saturn: about 1222000 km')
            print('Farest distance to the Saturn: about 1222000 km')
            enter = input('Enter planet name to see details:')
        # ####Jupiter#####
        if (enter == n):
            print('*Jupiter is the largest planet in the Solar System.')
            print('Diameter: 142984 km')
            print('Rotation time needed: 9 h 50 min 30 s')
            print('Revolution time needed: 11.8618 a')
            print('Nearest distance to the Sun: 740573600 km')
            print('Farest distance to the Sun: 816520800 km')
            print('Statellite:79 (found)')
            enter = input('Enter planet name to see details:')
        # ####lo#####
        if (enter == o):
            print('*lo is a statellite of Jupiter.')
            print('*It is also named as [Jupiter I].')
            print('Diameter: 3637.4 km')
            print('Rotation time needed: 1.769137786 d / 42 h')
            print('Revolution time needed: 1.769137786 d / 42 h')
            print('Nearest distance to the Jupiter: 420000 km')
            print('Farest distance to the Jupiter: 423400 km')
            enter = input('Enter planet name to see details:')
        # ####Europa#####
        if (enter == 'europa'):
            print('*Europa is a statellite of Jupiter.')
            print('*It is also named as [Jupiter II].')
            print('Diameter: 3183 km')
            print('Rotation time needed: - d')
            print('Revolution time needed: 3.5 d')
            print('Nearest distance to the Jupiter: about 670900 km')
            print('Farest distance to the Jupiter: about 670900 km')
            enter = input('Enter planet name to see details:')
        # ####Ganymede#####
        if (enter == 'ganymede'):
            print('*Ganymede is a statellite of Jupiter.')
            print('*It is also named as [Jupiter III].')
            print('*It is the largest statellite in the Solar System.')
            print('Diameter: 5262 km')
            print('Rotation time needed: - d')
            print('Revolution time needed: 7 d')
            print('Nearest distance to the Jupiter: 1069200 km')
            print('Farest distance to the Jupiter: 1071600 km')
            enter = input('Enter planet name to see details:')
        # ####Callisto#####
        if (enter == p):
            print('*Callisto is a statellite of Jupiter.')
            print('*It is also named as [Jupiter IV].')
            print('Diameter: 4800 km')
            print('Rotation time needed: 16.7 d')
            print('Revolution time needed: 16.7 d')
            print('Nearest distance to the Jupiter: about 1883000 km')
            print('Farest distance to the Jupiter: about 1883000 km')
            enter = input('Enter planet name to see details:')
        # ####Uranus#####
        if (enter == 'uranus'):
            print('Diameter: 51118 km')
            print('Rotation time needed: 17 h 14 min 24 s')
            print('Revolution time needed: 84.0205 a')
            print('Nearest distance to the Sun: 2784938461 km')
            print('Farest distance to the Sun: 3004419704 km')
            print('Statellite:29 (found)')
            enter = input('Enter planet name to see details:')
        # ####Ariel#####
        if (enter == q):
            print('*Ariel is statellite of Uranus.')
            print('*It is also named as [Uranus I].')
            print('Diameter: about 1158 km')
            print('Rotation time needed: 2.52 d')
            print('Revolution time needed: 2.52 d')
            print('Nearest distance to the Uranus: about 190900 km')
            print('Farest distance to the Uranus: about 190900 km')
            enter = input('Enter planet name to see details:')
        # ####AI 1#####
        if (enter == 'what can this program do' or enter == 'what can this program do?'):
            print('This prgram is about planets.')
            time.sleep(2)
            print('You can learn things about planets in this program.')
            time.sleep(3)
            enter = input('Enter planet name to see details:')
        # ####AI 2#####
        if (enter == 'what can you do' or enter == 'what can you do?'):
            print('I can let you to know details about planets.')
            time.sleep(2)
            enter = input('Enter planet name to see details:')
        # ####Umbriel#####
        if (enter == r):
            print('*Umbriel is a statellite of Uranus')
            print('*It is also named as [Uranus II].')
            print('Diameter: 1170 km')
            print('Rotation time needed: 4.1 d')
            print('Revolution time needed: 4.1 d')
            print('Nearest distance to the Uranus: 265980 km')
            print('Farest distance to the Uranus: 265980 km')
            enter = input('Enter planet name to see details:')
        # ####Titania#####
        if (enter == s):
            print('*Titania is a statellite of Uranus.')
            print('*It is also named as [Uranus III].')
            print('Diameter: 1578 km')
            print('Rotation time needed: 8.705 d')
            print('Revolution time needed: 8.705 d')
            print('Nearest distance to the Uranus: about 435910 km')
            print('Farest distance to the Uranus: about 435910 km')
            enter = input('Enter planet name to see details:')
        # ####Oberon#####
        if (enter == t):
            print('*Oberon is a statellite of Uranus.')
            print('*It is also named as [Uranus IV].')
            print('Diameter: about 762 km')
            print('Rotation time needed: 13.463234 d')
            print('Revolution time needed: 13.463234 d')
            print('Nearest distance to the Uranus: about 583520 km')
            print('Farest distance to the Uranus: about 583520 km')
            enter = input('Enter planet name to see details:')
        # ####Neptune#####
        if (enter == u):
            print('Diameter: 49532 km')
            print('Rotation time needed: 15 h 57 min 59 s')
            print('Revolution time needed: 60327.624 d')
            print('Nearest distance to the Sun: 4452940833 km')
            print('Farest distance to the Sun: 455394喵90 km')
            print('Statellite:14 (found)')
            enter = input('Enter planet name to see details:')
        # ####Triton#####
        if (enter == v):
            print('*Triton is a statellite of Neptune.')
            print('*It is also named as [Neptune I].')
            print('Diameter: about 2706.8 km')
            print('Rotation time needed: - d')
            print('Revolution time needed: 5.8 d')
            print('Nearest distance to the Neptune: about 355000 km')
            print('Farest distance to the Neptune: about 355000 km')
            enter = input('Enter planet name to see details:')
        # ####Nereid#####
        if (enter == w):
            print('*Nereid is a statellite of Neptune.')
            print('*It is also named as [Neptune II].')
            print('Diameter: 340 km')
            print('Rotation time needed: - d')
            print('Revolution time needed: 360.13619 d')
            print('Nearest distance to the Neptune: 1353600 km')
            print('Farest distance to the Neptune: 9623700 km')
            enter = input('Enter planet name to see details:')
        # ####Naiad#####
        if (enter == x):
            print('*Naiad is a statellite of Neptune.')
            print('*It is also named as [Neptune III].')
            print('Diameter: about 66 km')
            print('Rotation time needed: - d')
            print('Revolution time needed: 7 h 6 min')
            print('Nearest distance to the Neptune: about 48227 km')
            print('Farest distance to the Neptune: about 48227 km')
            enter = input('Enter planet name to see details:')
        # ####Proteus#####
        if (enter == y):
            print('*Proteus is a statellite of Neptune.')
            print('*It is also named as [Neptune VIII].')
            print('Diameter: about 416 km')
            print('Rotation time needed: 26.935554 h')
            print('Revolution time needed: 26.935554 h')
            print('Nearest distance to the Neptune: - km')
            print('Farest distance to the Neptune: - km')
            enter = input('Enter planet name to see details:')
        # ####Pluto#####
        if (enter == z):
            print('Diameter: 2370 km')
            print('Rotation time needed: 6 d 9 h 17 min 36 s (anti-clockwise)')
            print('Revolution time needed: 90581 d')
            print('Nearest distance to the Sun: 4437000000 km')
            print('Farest distance to the Sun: 7311000000 km')
            print('Statellite:5 (found)')
            enter = input('Enter planet name to see details:')
        #####cls#####
        if enter=="cls":
            os.system("cls")
            time.sleep(0.5)
            enter = input('Enter planet name to see details:')
        #####cmd#####
        while enter=="cmd":
            cmdenter=input("[Windows] / [Andriod] [Python] cmd > ")
            os.system(cmdenter)
            if cmdenter=="exit":
                enter = input('Enter planet name to see details:')

 

【提示】

部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:

https://python.codemao.cn


回复

上一页1 页 / 共 0下一页