Hollow Diamond
Drawing different shapes with the help of coding is quite enjoyable and interesting. Mostly the first semester students of software engineering encounter with this.
so, let us learn, how to draw a hollow diamond using python?
First of all declare variables:
Diamond consists of two cones, upper cone with pointed top and lower cone with pointed bottom.
so let us write the code for the upper cone, but the cone must be hollow:
The resultant of this code is as under:
Now, write the code for lower hollow cone:
The output for this code is:
Now, run both the codes simultaneously, and the output is:
the reason for this output:
This is one of the possibilities of writing code, to get this output. There might be other ways of doing the same task. Keep finding and trying different ways of coding. And do remember: Programming language doesn't matter but logic matters. So, work mainly on logic building.
Comments
Post a Comment