FIFA-2022 Career Guide Free Tutorials Go to Your University Placement Preparation 
0 like 0 dislike
10.9k views

1 Answer

0 like 0 dislike
by Goeduhub's Expert (5.8k points)
edited by
 
Best answer

Program Code

import pygame

import math

import sys

pygame.init()

#setting screen size

screen = pygame.display.set_mode((600, 300)) 

#setting caption

pygame.display.set_caption("Elliptical orbit")

#creating clock variable

clock=pygame.time.Clock() 

while(True):

    for event in pygame.event.get():

        if event.type == pygame.QUIT:

            sys.exit()

# setting x and y radius of ellipse    

    xRadius = 250

    yRadius = 100

    for degree in range(0,360,10):

        x1 = int(math.cos(degree * 2 * math.pi/360) * xRadius)+300

        y1 = int(math.sin(degree * 2 * math.pi/360) * yRadius)+150

        screen.fill((0, 0, 0))

        pygame.draw.circle(screen, (255, 69, 0), [300, 150], 40)

        pygame.draw.ellipse(screen,(255,255,255),[50,50,500,200],1)

        pygame.draw.circle(screen, (0, 255, 0), [x1, y1], 20)

        pygame.display.flip()

        clock.tick(5)# screen refresh rate

Output


For more RGPV/UTMP CSE V Sem Python Lab Experiments Click here


Learn & Improve In-Demand Data Skills Online in this Summer With  These High Quality Courses[Recommended by GOEDUHUB]:-

Best Data Science Online Courses[Lists] on:-

Claim your 10 Days FREE Trial for Pluralsight.

Best Data Science Courses on Datacamp
Best Data Science Courses on Coursera
Best Data Science Courses on Udemy
Best Data Science Courses on Pluralsight
Best Data Science Courses & Microdegrees on Udacity
Best Artificial Intelligence[AI] Courses on Coursera
Best Machine Learning[ML] Courses on Coursera
Best Python Programming Courses on Coursera
Best Artificial Intelligence[AI] Courses on Udemy
Best Python Programming Courses on Udemy

Related questions

 Important Lists:

Important Lists, Exams & Cutoffs Exams after Graduation PSUs

 Goeduhub:

About Us | Contact Us || Terms & Conditions | Privacy Policy ||  Youtube Channel || Telegram Channel © goeduhub.com Social::   |  | 

 

Free Online Directory

...