+ 2

can I ask???

what should I learn (in Python) to make shapes, like in code playground / most popular / car by Sutax Kapoor please help I want to make shapes

23rd Oct 2016, 9:57 AM
Edwin Pratt
Edwin Pratt - avatar
2 Answers
+ 2
To design a shape as done by Sutax Kapoor, you just need to know the print() function. If you see his code, he is simply pronting out " ", "-", "/", "|" and "\" to look like car. Its kind of innovative artistic programming. But if you are more interested in learning programming, you can define some functions like draw wheel(), draw windows () etc. and then print the combined design line by line. Now you can reuse them to draw any similar vehicle without manually writing code for printing each and every symbols as done by Sutax Kapoor. See the example below, in which instead of manually printing each character manually, loop is used to do it. It can be scaled up very easily. Example: #Rolling Amination from random import randint import time animation = '\|/-' for i in range(randint(1,2)): for j in range(len(animation)): print(animation[j], end = "\r", flush = True) j += 1 time.sleep(0.1) i += 1
23rd Oct 2016, 11:39 AM
Rohit Kumar
+ 1
.
26th Oct 2016, 7:27 PM
David Julio
David Julio - avatar