Jump to content

Cowsays - Python !

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
4 replies to this topic

#1
Turk4n

Turk4n

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 3,847 posts
Credits goes to me !
This time I made a funny thing !
I have posted two other versions, java and c++ version.

Java Version
http://forum.codecal...035-cowsay.html
C++ Version
http://forum.codecal...-c-version.html

Python Version
import sys

if sys.argv[1] != "cowsay":

    print "Usage:\n 'cowsay string'"

    sys.exit(0)


cowsay = sys.argv[2]

lne0 = 2+len(cowsay)

line0 = "  "

line0 = line0+"_"*lne0

lne = 2+len(cowsay)

line = "-"*lne


cowtxt= line0+"\n\

 < "+cowsay+" > \n\

  "+line+" \n\

         \   ^__^ \n\

          \  (oo)\_______ \n\

             (__)\       )\/\ \n\

                 ||----w | \n\

                 ||     ||\

                     "

print cowtxt
Hope you guys like it and +rep me for creativity :P
Also the Java and C++ versions are NOT mine, so thank the rightful owners for them :)
Posted Image

#2
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
This is a great example of the fact that the language doesn't matter that much. The code looks basically the same in all three languages! Very nice. +rep
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#3
Turk4n

Turk4n

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 3,847 posts

WingedPanther said:

This is a great example of the fact that the language doesn't matter that much. The code looks basically the same in all three languages! Very nice. +rep

Thank you :D, hope one of those three will come in hand :)
Posted Image

#4
Egz0N

Egz0N

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 4,034 posts
nice one .. a +rep from me too :)

#5
Turk4n

Turk4n

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 3,847 posts

Egz0N said:

nice one .. a +rep from me too :)

Thanks :D
Posted Image