Write a python program to simulate Elliptical Orbit.

Thiru Malai
2 min readJun 10, 2021

PYTHON

Python is the popular programming language and we can surely say that it is the next-generation programming language. In every emerging field of computer science, Python makes its presence without fail. Python has huge libraries for various fields such as Machine Learning (Numpy, Pandas, Matplotlib), Artificial intelligence (Pytorch, TensorFlow), and Game development (Pygame,Pyglet).

What is pygame?

This question may rise in many of our mind…. in simple it is nothing but a cross-platform set of Python modules which is used to create video games

Installation of Pygame:

step1- Go to the command prompt.

step2- Then type ”pip install pygame”. It will start to download now you can execute any game development related program.

installation

Now, lets come to our program. Simulating eliptical orbit using python programming.

Concepts Involved in this program is very simple….

What is import?

An import statement is made up of the import keyword along with the name of the module. In a Python file, this will be declared at the top of the code.

While loop

While loop will be executed only if the condition is true in the block of code.

Syntax:

syntax

For loop

For loop has the ability to iterate over the items of any sequence(that is either a list, a tuple, a dictionary, a set, or a string), such as a list or a string.

Syntax

syntax

init() Function:

All classes have a function called __init__(), which is always executed when the class is being initiated.

Use the __init__() function to assign values to object properties, or other operations that are necessary to do when the object is being created.

Code:

Output:

Refer GUVI to learn more about Python.

--

--