The Joy of Programming
Hello, Joy!

Welcome to the Joy of Programming!

In this course we are going to learn programming by writing programs to create interesting shapes and patterns.

We'll be using Python programming language for this course along with a library Joy, which is already included in the course environment.

Let's get a taste of Joy by writing our first program.

c = circle()
show(c)

When you run the program you'll see a circle at the center of a canvas.

In the above example, circle is function that creates a circle shape and show is a function that takes a shape and draws it on the screen.

The function circle is provide by the Joy library. It has many other functions for various shapes and doing some operations on them, which you'll see in the upcoming lessons.

Here is a small exercise for you.

Exercise 1.1: Rectangle

Just like circle function creates a circle shape, the rectangle function creates a rectangle. Change the program in the editor below to show a rectangle instead of circle.


Making Sketches

One interesting part of this Mon.School platform is the functioanality to create your own sketches by writing programs. You can see recent sketches drawn by the students on the home page or on the Sketches page linked from the top navigation bar.

Please go to Sketches and create a new sketch to draw a circle or a rectangle.

We'll see how to draw more shapes and patterns in the upcoming lessons.

Questions
test
rakii rakesh
2 months ago
Post
Dismiss

hi

hi

Want to discuss?
Post it here, our mentors will help you out.
output not displaying
Pradeep Kumars
1 year ago
Post
Dismiss
Recently notice that even we run the code or submit , output not displaying .Tried with different browsers also same . How to solve it ?Thanks
Recently notice that even we run the code or submit , output not displaying .Tried with different browsers also same . How to solve it ?Thanks
Want to discuss?
Post it here, our mentors will help you out.
Swetha EV
2 years ago
Post
Dismiss
What is the code for drawing a square
What is the code for drawing a square
AP Aysha PS
2 years ago
Post
Dismiss
shape = circle() show(shape)
shape = circle() show(shape)
OR Ouchith Rajeendran
2 years ago
Post
Dismiss
shape = square() show(shape)
shape = square() show(shape)
FF Fathima Faraiya
2 years ago
Post
Dismiss
shape= square() show(shape)
shape= square() show(shape)
AP Ashish Prasannan
2 years ago
Post
Dismiss
shape = rectangle(w=100, h=100) show(shape)
shape = rectangle(w=100, h=100) show(shape)
MJ Meenakshi Jayakumar
2 years ago
Post
Dismiss
shape=square() show(shape)
shape=square() show(shape)
Lovebin Robin
2 years ago
Post
Dismiss
Sir how do I install the package joy in vscode
Sir how do I install the package joy in vscode
Want to discuss?
Post it here, our mentors will help you out.
Swetha EV
2 years ago
Post
Dismiss
How to specify the rectangle side lenght.
How to specify the rectangle side lenght.
Anand Chitipothu
2 years ago
Post
Dismiss
You can specify width and height of a rectangle using arguments `w` and `h`. ``` shape = rectangle(w=50, h=100) show(shape) ``` See lesson [2.3. Rectangles and Ellipses](https://mon.school/courses/the-joy-of-programming/learn/2.3) for more details.
You can specify width and height of a rectangle using arguments `w` and `h`. ``` shape = rectangle(w=50, h=100) show(shape) ``` See lesson [2.3. Rectangles and Ellipses](https://mon.school/courses/the-joy-of-programming/learn/2.3) for more details.
FF Fathima Faraiya
2 years ago
Post
Dismiss
shape = rectangle(w=50, h=100) show(shape)
shape = rectangle(w=50, h=100) show(shape)
MJ Meenakshi Jayakumar
2 years ago
Post
Dismiss
shape=rectangle(w=50,h=100) show(shape)
shape=rectangle(w=50,h=100) show(shape)
Want to discuss?
Post it here, our mentors will help you out.
Circle
NM Neh Mahesh
2 years ago
Post
Dismiss
what is the difference between? 1st: c=circle(r=50) show(c) & 2nd: c=circle(50) show(c) both outputs are different, why it is so?
what is the difference between? 1st: c=circle(r=50) show(c) & 2nd: c=circle(50) show(c) both outputs are different, why it is so?
SS Sephin Sebastian
2 years ago
Post
Dismiss
Your first program sets the radius of the circle to 50, which is by default 100. And in your second program, you're not setting the radius of the circle. I think when you input only a number in the circle() function without assigning it to the radius, it shifts the circle's centre horizontically. Positive values shift circles to the right and negative values to the left.
Your first program sets the radius of the circle to 50, which is by default 100. And in your second program, you're not setting the radius of the circle. I think when you input only a number in the circle() function without assigning it to the radius, it shifts the circle's centre horizontically. Positive values shift circles to the right and negative values to the left.
Anand Chitipothu
2 years ago
Post
Dismiss
The function `circle` takes three arguments `x`, `y` and `r`. When you say `circle(r=50)` you are specifying the radius, but when you say `circle(50)`, you are passing the value of `x`, which is same as `circle(x=50)`. To avoid this confusion, we suggest passing arguments by name as much as possible.
The function `circle` takes three arguments `x`, `y` and `r`. When you say `circle(r=50)` you are specifying the radius, but when you say `circle(50)`, you are passing the value of `x`, which is same as `circle(x=50)`. To avoid this confusion, we suggest passing arguments by name as much as possible.
FF Fathima Faraiya
2 years ago
Post
Dismiss
In the first command, we are specifying the radius of the circle, but i didnt understand about the second command
In the first command, we are specifying the radius of the circle, but i didnt understand about the second command
Want to discuss?
Post it here, our mentors will help you out.
c c
Yeldos Nurymov
2 years ago
Post
Dismiss
cx
cx
Want to discuss?
Post it here, our mentors will help you out.