(✿ ♥‿♥)
python -c “while 1: locals().setdefault(‘i’,60); import time,random; print(‘ ‘*i+”+’ ‘*(80-i-1)+’|’);time.sleep(.2); i+=random.randint(-2,2)”
python -c “while 1:import random;print “random.randint(0,100)”, map(lambda n:(lambda f:f(f,n))(lambda f,n:{True:lambda:1, False:lambda:n*f(f,n-1)}[n<=1]()),range(0,20))"
python -c “import random,time; p=lambda:random.choice(‘♥♦♣♠’);[print ‘[{}|{}|{}]’.format(p(),p(),p(),t=time.sleep(.2)), for i in range (20)]”
python -c “while 1: locals().setdefault(‘i’,60); import time,random; print(‘ ‘*i+”+’ ‘*(80-i-1)+’|’); time.sleep(.1); i+=random.randint(-2,2)”
python -c “import random,time; p=lambda:random.choice(‘♥♦♣♠’);[print(‘[{}|{}|{}]’ .format(p(),p(),p(),t=time.sleep(.1)),end= ‘\r’) for i in range (20)]”
python -c “import random;n=random.randint(1,99); [(lambda a:print(‘Y’ if a==n else ‘H’ if a>n else ‘L’))(int(input())) for i in range(6)]”
python -c “while 1:import random; print(random.choice(‘|-_+=\\/’), end=”)”
You are trying to learn programming and many people suggested to learn Python as the first language. You take their advice, you download Python and get all set up. Maybe you take a tutorial or two in order to learn some basic syntax… Now you are sitting in front of your computer and you are wondering what to do next. I suggest you start on some projects and get programming to learn more Python. I have compiled a few available projects myself… and will include the source code in this post.
Refrain from looking at the source code, even when your stuck. If you get to the point where you have nowhere else to look, take a tiny peak but then go straight back and start doing your work again. If your programs works and our source code doesn’t match, pat yourself on the back! Then look at my source code versus yours and see how you can shorten and make your programs better or if you feel that you came up with a better solution let me know of it.
My way of doing it, is probably not the best way,so go on and explore and experiment!
Pygame is a software library that has modules for graphics, sound, and other features that games commonly use.
Check your paths right click on Computer(icon) got to Properties and click on Advanced system settings.Go to environmental variables.Update the following paths.
#Case sensitive #
Variable Value
Path ;C:\Python27(remove the previous version of python and do this i.e.. change 34 to 27)
PYTHONHOME C:\Python27
PYTHONPATH C:\Python27
(PS:I randomly update since I am not very comfortable with my incoherent .py files )
If you are new to Python programming or in computer programming in general, it would certainly be important for you to get some information on the advantages and disadvantages of the language and understand why would somebody want to use it. In this post, I will not enter into the technical details of the language nor use fancy words to describe you some of the language specifics. My intention is to give you some simple insight so that you can decide for yourself whether or not it would be a good idea for you to choose Python as your main programming language!
Easy to Learn
As you will see, Python is extremely easy to get started with. Python has an extraordinarily simple syntax, as already mentioned.
Free and Open Source
Python is an example of a FLOSS (Free/Libré and Open Source Software). In simple terms, you can freely distribute copies of this software, read it’s source code, make changes to it, use pieces of it in new free programs, and that you know you can do these things. FLOSS is based on the concept of a community which shares knowledge. This is one of the reasons why Python is so good – it has been created and is constantly improved by a community who just want to see a better Python.
High-level Language
When you write programs in Python, you never need to bother about the low-level details such as managing the memory used by your program, etc.
Portable
Due to its open-source nature, Python has been ported (i.e. changed to make it work on) to many platforms. All your Python programs can work on any of these platforms without requiring any changes at all if you are careful enough to avoid any system-dependent features. You can use Python on Linux, Windows, FreeBSD, Macintosh, Solaris, OS/2, Amiga, AROS, AS/400, BeOS, OS/390, z/OS, Palm OS, QNX, VMS, Psion, Acorn RISC OS, VxWorks, PlayStation, Sharp Zaurus, Windows CE and even PocketPC !
Interpreted
This requires a bit of explanation.
A program written in a compiled language like C or C++ is converted from the source language i.e. C or C++ into a language that is spoken by your computer (binary code i.e. 0s and 1s) using a compiler with various flags and options. When you run the program, the linker/loader software copies the program from hard disk to memory and starts running it.
Python, on the other hand, does not need compilation to binary. You just run the program directly from the source code. Internally, Python converts the source code into an intermediate form called bytecodes and then translates this into the native language of your computer and then runs it. All this, actually, makes using Python much easier since you don’t have to worry about compiling the program, making sure that the proper libraries are linked and loaded, etc, etc. This also makes your Python programs much more portable, since you can just copy your Python program onto another computer and it just works!
Object Oriented
Python supports procedure-oriented programming as well as object-oriented programming. In procedure-oriented languages, the program is built around procedures or functions which are nothing but reusable pieces of programs. In object-oriented languages, the program is built around objects which combine data and functionality. Python has a very powerful but simplistic way of doing OOP, especially when compared to big languages like C++ or Java.
Extensible
If you need a critical piece of code to run very fast or want to have some piece of algorithm not to be open, you can code that part of your program in C or C++ and then use them from your Python program.
Embeddable
You can embed Python within your C/C++ programs to give ‘scripting’ capabilities for your program’s users.
Extensive Libraries
The Python Standard Library is huge indeed. It can help you do various things involving regular expressions, documentation generation, unit testing, threading, databases, web browsers, CGI, ftp, email, XML, XML-RPC, HTML, WAV files, cryptography, GUI (graphical user interfaces), Tk, and other system-dependent stuff. Remember, all this is always available wherever Python is installed. This is called the ‘Batteries Included’ philosophy of Python. Besides, the standard library, there are various other high-quality libraries such as wxPython, Twisted, Python Imaging Library,PyGame and many more.
Summary
Python is indeed an exciting and powerful language. It has the right combination of performance and features that make writing programs in Python both fun and easy.
Quick! Which programming language will get you up and running writing applications on every popular platform around?
The amazing thing about Python is that you really can write an application on one platform and use it on every other platform that you need to support.
Unlike the other programming languages that promised to provide platform independence, Python really does make that independence possible.
Python emphasises code readability and a concise syntax that lets you write applications using fewer lines of code than other programming languages require.
This post is all about getting up and running with Python quickly. You want to learn the language fast so that you can become productive in using it to perform your real job, which could be anything.
Unlike most, on the topic, this one starts you right at the beginning by showing you what makes Python different from other languages and how it can help you perform useful work in a job other than programming. You even get help with installing Python on your particular system.
Many programming languages are available today. In fact, a student can spend an entire semester in college studying computer languages and still not hear about them all. (I have done just that during my college days.)
You’d think that programmers would be happy with all these programming languages and just choose one to talk to the computer, but they keep inventing more. Programmers keep creating new languages for good reason.
Each language has something special to offer — something it does exceptionally well. In addition, as computer technology evolves, so do the programming languages in order to keep up. Because creating an application is all about efficient communication, many programmers know multiple programming languages so that they can choose just the right language for a particular task. One language might work better to obtain data from a database, and another might create user interface elements especially well.
As with every other programming language, Python does some things exceptionally well, and you need to know what they are before you begin using it.
You might be amazed by the really cool things you can do with Python.Knowing a programming language’s strengths and weaknesses helps you use it better as well as avoid frustration by not using the language for things it doesn’t do well. The following sections help you make these sorts of decisions about Python.
Less application development time:
Python code is usually 2–10 times shorter than comparable code written in languages like C/C++ and Java, which means that you spend less time writing your application and more time using it.
Ease of reading:
A programming language is like any other language — you need to be able to read it to understand what it does. Python code tends to be easier to read than the code written in other languages, which means you spend less time interpreting it and more time making essential changes.
Reduced learning time:
Creating rough application examples:
Scripting browser-based applications:
Even though JavaScript is probably the most popular language used for browser-based application scripting, Python is a close second. Python offers functionality that JavaScript doesn’t provide and its high efficiency makes it possible to create browser-based applications faster (a real plus in today’s fast-paced world).
Designing mathematical, scientific, and engineering applications:
Working with XML:
The eXtensible Markup Language (XML) is the basis of most data storage needs on the Internet and many desktop applications today. Unlike most languages, where XML is just sort of bolted on, Python makes it a first-class citizen. If you need to work with a Web service, the main method for exchanging information on the Internet (or any other XML-intensive application), Python is a great choice.
Interacting with databases:
Business relies heavily on databases. Python isn’t quite a query language, like the Structure Query Language (SQL) or Language INtegrated Query (LINQ), but it does do a great job of interacting with databases. It makes creating connections and manipulating data relatively painless.
Python isn’t like some languages like C# where you have a built-in designer and can drag and drop items from a toolbox onto the user interface. However, it does have an extensive array of graphical user interface (GUI) frameworks — extensions that make graphics a lot easier to create . Some of these frameworks do come with designers that make the user interface creation process easier. The point is that Python isn’t devoted to just one method of creating a user interface — you can use the method that best suits your needs.
As mentioned earlier on what my plan is regarding the posts…
I have a Compiled .py (python file) with needed comments covering the most of python basics that was allotted for the days post …I felt that there were too many comment lines inside so I am attaching another copy of the .py file without the long and boring comments, this is for people like me who jump into the heart of the problem and try and get enough experience getting out of it