• API
• FAQ
• Tools
• Trends
• Archive
daily pastebin goal
24%
SHARE
TWEET

# Planet Distance from sun program problem

a guest Aug 14th, 2012 43 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. import time, os, random
2. from color import randomColor
3. randomColor()
4. mercury = "57.9"
5. venus = "108.2"
6. earth = "149.6"
7. mars = "227.9"
8. jupiter = "778.3"
9. saturn = "1.427"
10. uranus = "2.869"
11. neptune = "4.496"
12. pluto = "5.9"
13. mercury2 = "57900000"
14. venus2 = "108200000"
15. earth2 = "149600000"
16. mars2 = "227900000"
17. jupiter2 = "778300000"
18. saturn2 = "1427000000"
19. uranus2 = "2869000000"
20. neptune2 = "4496000000"
21. pluto2 = "5900000000"
22.
23.
24. def main():
25.
26.
27.     print "Planetary Distance from the Sun"
28.     time.sleep(.5)
29.     rand = random.randint(1,1)
30.     if rand==1:
31.         Mercury()
32.     elif rand==2:
33.         Venus()
34.     elif rand==3:
35.         Earth()
36.     elif rand==4:
37.         Mars()
38.     elif rand==5:
39.         Jupiter()
40.     elif rand==6:
41.         Saturn()
42.     elif rand==7:
43.         Uranus()
44.     elif rand==8:
45.         Neptune()
46.     else:
47.         Pluto()
48.
49. def Mercury():
50.     ans = raw_input("How far is Mercury from the sun? ")
51.     if mercury or mercury2 in ans:
52.         print "Correct!"
53.         time.sleep(.5)
54.         os.system("cls")
55.         main()
56.     else:
57.         print "Incorrect!"
58.         Mercury()
59.
60. def Venus():
61.     ans = raw_input("How far is Venus from the sun? ")
62.     if ans == venus or venus2:
63.         print "Correct!"
64.         time.sleep(.5)
65.         os.system("cls")
66.         main()
67.     else:
68.         print "Incorrect!"
69.         Venus()
70.
71. def Earth():
72.     ans = raw_input("How far is Earth from the sun? ")
73.     if ans == earth or earth2:
74.         print "Correct!"
75.         time.sleep(.5)
76.         os.system("cls")
77.         main()
78.     else:
79.         print "Incorrect!"
80.         Earth()
81.
82. def Mars():
83.     ans = raw_input("How far is Mars from the sun? ")
84.     if ans == mars or mars2:
85.         print "Correct!"
86.         time.sleep(.5)
87.         os.system("cls")
88.         main()
89.     else:
90.         print "Incorrect!"
91.         Mars()
92.
93. def Jupiter():
94.     ans = raw_input("How far is Jupiter from the sun? ")
95.     if ans == jupiter or jupiter2:
96.         print "Correct!"
97.         time.sleep(.5)
98.         os.system("cls")
99.         main()
100.     else:
101.         print "Incorrect!"
102.         Jupiter()
103.
104. def Saturn():
105.     ans = raw_input("How far is Saturn from the sun? ")
106.     if ans == saturn or saturn2:
107.         print "Correct!"
108.         time.sleep(.5)
109.         os.system("cls")
110.         main()
111.     else:
112.         print "Incorrect!"
113.         Saturn()
114.
115. def Uranus():
116.     ans = raw_input("How far is Uranus from the sun? ")
117.     if ans == uranus or uranus2:
118.         print "Correct!"
119.         time.sleep(.5)
120.         os.system("cls")
121.         main()
122.     else:
123.         print "Incorrect!"
124.         Uranus()
125.
126. def Neptune():
127.     ans = raw_input("How far is Neptune from the sun? ")
128.     if ans == neptune or neptune2:
129.         print "Correct!"
130.         time.sleep(.5)
131.         os.system("cls")
132.         main()
133.     else:
134.         print "Incorrect!"
135.         Neptune()
136.
137. def Pluto():
138.     ans = raw_input("How far is Pluto from the sun? ")
139.     if ans == pluto or pluto2:
140.         print "Correct!"
141.         time.sleep(.5)
142.         os.system("cls")
143.         main()
144.     else:
145.         print "Incorrect!"
146.         Pluto()
147.
148. main()
RAW Paste Data
Top