General purpose language that could be used almost everywhere 3. Flexibility and scalability 4. Multi-paradigm: object oriented, functional, procedural etc. 5. Popular language, big community 6. Fun to work with 7. Career Opportunities
GUI applications Network applications System Administration / DevOps Scienti c Applications Data Science Projects Machine Learning / Deep learning and much more
2. Python 3 is ready for the production deployment of applications today. 3. Python 2.7 will only receive necessary security updates until 2020. 4. The brand name “Python” encapsulates both Python 3 and Python 2.
most modern linux distros like Debian, Fedora, Centos etc. In case it's not preinstalled you can always download it from the of cial website. Windows You can download the installer from the of cial website. https://www.python.org/downloads/
to write code in python as long as it supports syntax highlighting. Here are some recommended editors/IDEs: Microsoft Vscode Atom Sublime Vim Jetbrains PyCharm IDE
➜ python Python 2.7.12 (default, Nov 19 2016, 06:48:10) [GCC 5.4.0 20160609] on linux2 Type "help", "copyright", "credits" or "license" for more informa >>> Then >>> print "Hello World!" Hello World!
and running it from the command line essentially triggers the following steps: 1. The source is compiled the rst time it is encountered (e.g., imported as a module or directly executed). This step generates the binary le, with a pyc or pyo extension depending on your system. 2. The interpreter reads the binary le and executes the instructions (opcodes) one at a time. From http://security.coverity.com/blog/2014/Nov/understanding-python-bytecode.html
World! print "Hello World!" # This is a comment; single line comment """ And this is a multiline comment. As this could take more than one line of comments. Like this. """ print "Hello Again." Output: Hello World! Hello Again.
"Hello World!" print "Hello Again." print "We enjoy typing." print "Learning python is easy." print "And fun." print "Printing text is way easier." Output: Hello World! Hello Again. We enjoy typing. Learning python is easy. And fun. Printing text is way easier.
+ One =", 1 + 1 print "One - Two =", 1 - 2 print "Two * Five =", 1 * 5 print "Four / Two =", 4 / 2 print "Expression (12 * 5) - (2 ^ 3) + (1 / 2) =", ((12 * 5) - ( print "Seven is less than or equal to Six is", 7 <= 6 Output: One + One = 2 One - Two = -1 Two * Five = 5 Four / Two = 2 Expression (12 * 5) - (2 ^ 3) + (1 / 2) = 52 Seven is less than or equal to Six is False
= "Baidhya" dob = "July 30, 1992" home_town = "Kathmandu, Nepal" print "Hi! I am", first_name, last_name, "." print "I was born on", dob, "." print "I'm from", home_town, "." Output: Hi! I am Kabir Baidhya . I was born on July 30, 1992 . I'm from Kathmandu, Nepal .
"Baidhya" dob_month = "July" dob_day = 30 dob_year = 1992 difficulty = "easy" print "Hi! I am %s %s." % (first_name, last_name) print "I was born on %s %d, %d." % (dob_month, dob_day, dob_year) print "Python is %s to learn." % difficulty Output: Hi! I am Kabir Baidhya. I was born on July 30, 1992. Python is easy to learn.
This would take input from the user # and store it in a variable. name = raw_input() print "Hi! %s. \nIt's nice to meet you." % (name) print "Hope you're doing good." Output: What is your name? Kabir Hi! Kabir. It's nice to meet you. Hope you're doing good.
"dob": "July 30, 1992", "home_town": "Kathmandu, Nepal" } print "Hi! I am %s." % data["name"] print "I was born on %s." % data["dob"] print "I'm from %s." % data["home_town"] Output: Hi! I am Kabir Baidhya. I was born on July 30, 1992. I'm from Kathmandu, Nepal.