Home > Projects > Hello World
Python version 3.x
print("Hello, World!")
Hello World Ascii Variation
Create a file called HelloWorld.py
Then define two functions, with a for loop statement that repeatedly prints the "#" or "space" characters, until the specified number of repetitions evaluate to false. The parameter specifying the number of times to repeat the "#" or "space" is named a.
Two other functions are defined for when a '\n' is needed. These are named lastPound() and lastSpace()
def pound(a): for i in range(0,a): print('#', end="") def space(a): for i in range(0,a): print(' ', end="") def lastPound(): print('#') def lastSpace(): print(' ') lastSpace() pound(1); space(3); pound(1); space(1); pound(5); space(1); pound(1); space(5); pound(1); space(6); pound(3); space(5); pound(1); space(7); pound(1); space(2); pound(3); space(2); pound(4); space(2); pound(1); space(5); pound(4); space(3); lastPound(); pound(1); space(3); pound(1); space(1); pound(1); space(5); pound(1); space(5); pound(1); space(5); pound(1); space(3); pound(1); space(4); pound(1); space(3); pound(1); space(3); pound(1); space(1); pound(1); space(3); pound(1); space(1); pound(1); space(3); pound(1); space(1); pound(1); space(5); pound(1); space(3); pound(1); space(2); lastPound(); pound(5); space(1); pound(5); space(1); pound(1); space(5); pound(1); space(5); pound(1); space(3); pound(1); space(4); pound(1); space(3); pound(1); space(3); pound(1); space(1); pound(1); space(3); pound(1); space(1); pound(4); space(2); pound(1); space(5); pound(1); space(3); pound(1); space(2); lastPound(); pound(1); space(3); pound(1); space(1); pound(1); space(5); pound(1); space(5); pound(1); space(5); pound(1); space(3); pound(1); space(5); pound(1); space(2); pound(1); space(2); pound(1); space(2); pound(1); space(3); pound(1); space(1); pound(1); space(2); pound(1); space(2); pound(1); space(5); pound(1); space(3); pound(1); space(2); lastSpace(); pound(1); space(3); pound(1); space(1); pound(5); space(1); pound(5); space(1); pound(5); space(2); pound(3); space(2); pound(1); space(4); pound(1); space(2); pound(1); space(5); pound(3); space(2); pound(1); space(3); pound(1); space(1); pound(5); space(1); pound(4); space(3); lastPound(); space(29); pound(1); space(38); lastSpace()
Run the file called HelloWorld.py:
C:\Program Files(x86)\Python\Python35-32>python HelloWorld.py
# # ##### # # ### # # ### #### # #### #
# # # # # # # # # # # # # # # # # #
##### ##### # # # # # # # # # #### # # # #
# # # # # # # # # # # # # # # # #
# # ##### ##### ##### ### # # # ### # # ##### #### #
#