Question

For this lab, you will create a python program locally on your machine, test it, then upload it to this page.

Create a new python file named "nightsky.py". It should begin like this:

  

# Lab: Night Sky
import turtle
import random

wn = turtle.Screen()
wn.title('Night Sky')

t = turtle.Turtle()
t.speed(0)

sky_limit = 300
star_size = 25
star_angle = 144
total_stars = 50
moon_radius = 80

# TODO: steps 1 through 5 (optionally 6, and 7)

wn.mainloop()

Step 6: • Add a full moon (using moon_radius) randomly located in the upper right quadrant: Step 7: • Make the moon a crescen

0 0
Add a comment Improve this question Transcribed image text
Answer #1
 import turtle import random wn=turtle.Screen() wn.title('Night Sky') turtle.bgcolor('blue') turtle.color('yellow') turtle.speed(0) def draw_star(): turns=5 turtle.begin_fill() while turns>0: turtle.forward(25) turtle.left(144) turns=turns-1 turtle.end_fill() draw_star() num=0 while num<50: x=random.randint(-300,300) y=random.randint(-300,300) draw_star() turtle.penup() turtle.goto(x,y) turtle.pendown() num+=1 def moon_radious(): x=random.randint(100,300) y=random.randint(100,300) turtle.penup() turtle.goto(x,y) turtle.pendown() turtle.fillcolor('yellow') turtle.begin_fill() turtle.circle(50) turtle.end_fill() def draw_cresentmoon(): turtle.bgcolor('dark blue') turtle.up() turtle.goto(0,100) turtle.color('yellow') turtle.begin_fill() turtle.circle(50) turtle.end_fill() turtle.up() turtle.goto(25,100) turtle.color('dark blue') turtle.begin_fill() turtle.circle(50) turtle.end_fill() moon_radious() draw_cresentmoon() window.exitonclick()

I have shown the code and with functions mentioned and If you want to change something like to adjust according to co-ordinates just change the co-ordinates.

WI jhfhgfhyg.py tyhbj.py E E @ED Editor - C:\Users\Suman Bhardwaj spyder-py3Vwsd.py temp.py uyfruygkh.py 3 mikkm.py ® import

35 37 by x uytruygkh.py x mlkkm.py jhfhgfhyg.py def moon_radious(): x=random.randint(100,300) y=random.randint(100,300) turtl

Tools View Help ut EUNICEFIE Night Sky (Not Responding) Permissions: RW End of lines CRLF E

I'm attaching the pic with the output and If you feel any problem feel free to comment.

Add a comment
Know the answer?
Add Answer to:
For this lab, you will create a python program locally on your machine, test it, then...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • This task is a program framework that you should complete. The program should allow the user...

    This task is a program framework that you should complete. The program should allow the user to move a circular figure with the mouse over a drawing area. The current position of the figure is displayed continuously: Given is the main program: import javafx.scene.Scene; import javafx.application.Application; import javafx.beans.value.*; import javafx.scene.*; import javafx.scene.paint.Color; import javafx.scene.text.Text; import javafx.stage.Stage; public class Main extends Application { private DraggableCircle dc; private Text text; private void updateText() { text.setText("("+dc.getCenterX()+", "+dc.getCenterY()+")"); } @Override public void start(final Stage...

  • C++ Programming Objects Problem Assignment: Programming challenge #1 on page 714: "File Head Program" Write a...

    C++ Programming Objects Problem Assignment: Programming challenge #1 on page 714: "File Head Program" Write a program that asks the user for the name of a file. The program should display the first ten lines of the file on the screen (the “head" of the file). If the file has fewer than ten lines, the entire file should be displayed, with a message indicating the entire file has been displayed. Lab Help: Use the following two files to test your...

  • In this lab you will write a spell check program. The program has two input files:...

    In this lab you will write a spell check program. The program has two input files: one is the dictionary (a list of valid words) and the other is the document to be spellchecked. The program will read in the words for the dictionary, then will read the document and check whether each word is found in the dictionary. If not, the user will be prompted to leave the word as is or type in a replacement word and add...

  • Lab Topics • The basics of Array object Use the following Coding Guidelines • When declaring...

    Lab Topics • The basics of Array object Use the following Coding Guidelines • When declaring a variable, you usually want to initialize it. Remember you cannot initialize a number with a string. Remember variable names are case sensitive. Use tabs or spaces to indent code within blocks (code surrounded by braces). Use white space to make your program more readable. Use comments after the ending brace of classes, methods, and blocks to identify to which block it belongs. Problem...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT