Loading [MathJax]/jax/output/HTML-CSS/fonts/TeX/fontdata.js

Important Notes To Remember : 
1. Python code is designed to be readable, and hence reusable and maintainable—much more so than traditional scripting languages. 
2. Python comes with a large collection of prebuilt and portable functionality, known as the standard library. 
3. Google makes extensive use of Python in its web search systems.
4. The popular YouTube video sharing service is largely written in Python.
5. The widespread BitTorrent peer-to-peer file sharing system began its life as a Python program.
6. Google’s App Engine web development framework uses Python as an application language.
7. Netflix and Yelp have both documented the role of Python in their software infrastructures.
8. Intel, Cisco, Hewlett-Packard, Seagate, Qualcomm, and IBM use Python for hardware testing.
9. JPMorgan Chase, UBS, Getco, and Citadel apply Python to financial market forecasting.
10. CPython is the standard implementation of the language.
11. Jython and IronPython implement Python programs for use in Java and .NET environments, respectively; they are alternative compilers for Python.

Interpreter :  
1. A software package called an interpreter. An interpreter is a kind of program that executes other programs.
2. When you write a Python program, the Python interpreter reads your program and carries out the instructions it contains.
3. When the Python package is installed on your machine, it generates a number of components—minimally, an interpreter and a support library.

Python Installation:  Learn from video lectures (Windows, Mac & Linux)

Byte code compilation:
when you execute a program Python first compiles your source code (the statements in your file) into a format known as byte code.
EX. a .pyc extension (“.pyc” means compiled “.py” source).
a.py >> a.pyc >> PVM
Source Code >> Byte Code >> RunTime

 

Important Topics :

1. Variables : Python uses 'Dynamic Typing' , Means you can reassign the variables to different data type.
EX. my_dog = 2  // Integer data typed
      my_dog = ["Tom" , "John"]   // list data typed

2. Strings : 

>>> S = 'Spam'    # Make a 4-character string, and assign it to a name
>>> len(S)            # Length
4
>>> S[0]               # The first item in S, indexing by zero-based position
'S'
>>> S[1]               # The second item from the left
'p'

>>> S[-1]                # The last item from the end in S
'm'
>>> S[-2]                # The second-to-last item from the end
'a'

>>> S[-1]                # The last item in S
'm'
>>> S[len(S)-1]          # Negative indexing, the hard way
'm'

>>> S                     # A 4-character string
'Spam'
>>> S[1:3]                # Slice of S from offsets 1 through 2 (not 3)  //Gives us all the characters in string S from offsets 1 through 2 (that is, 1 through 3 – 1) as a new string.
'pa'

>>> S[1:]                 # Everything past the first (1:len(S))
'pam'
>>> S                     # S itself hasn't changed
'Spam'
>>> S[0:3]                # Everything but the last
'Spa'
>>> S[:3]                 # Same as S[0:3]
'Spa'
>>> S[:-1]                # Everything but the last again, but simpler (0:-1)
'Spa'
>>> S[:]                  # All of S as a top-level copy (0:len(S))
'Spam'

>>> S + 'xyz'             # Concatenation
'Spamxyz'
>>> S                     # S is unchanged
'Spam'
>>> S * 8                 # Repetition
'SpamSpamSpamSpamSpamSpamSpamSpam'

>>> S
'Spam'
>>> S[0] = 'z'             # Immutable objects cannot be changed
...error text omitted...
TypeError: 'str' object does not support item assignment
>>> S = 'z' + S[1:]        # But we can run expressions to make new objects
>>> S
'zpam'

>>> S = 'shrubbery'
>>> L = list(S)                                     # Expand to a list: [...]
>>> L
['s', 'h', 'r', 'u', 'b', 'b', 'e', 'r', 'y']
>>> L[1] = 'c'                                      # Change it in place
>>> ''.join(L)                                      # Join with empty delimiter
'scrubbery'
>>> B = bytearray(b'spam')                          # A bytes/list hybrid (ahead)
>>> B.extend(b'eggs')                               # 'b' needed in 3.X, not 2.X
>>> B                                               # B[i] = ord(c) works here too
bytearray(b'spameggs')
>>> B.decode()                                      # Translate to normal string
'spameggs'

>>> S = 'Spam'
>>> S.find('pa')                 # Find the offset of a substring in S
1
>>> S
'Spam'
>>> S.replace('pa', 'XYZ')       # Replace occurrences of a string in S with another
'SXYZm'
>>> S
'Spam'

>>> line = 'aaa,bbb,ccccc,dd'
>>> line.split(',')              # Split on a delimiter into a list of substrings
['aaa', 'bbb', 'ccccc', 'dd']
>>> S = 'spam'
>>> S.upper()                    # Upper- and lowercase conversions
'SPAM'
>>> S.isalpha()                  # Content tests: isalpha, isdigit, etc.
True

>>> S = 'A\nB\tC'            # \n is end-of-line, \t is tab
>>> len(S)                   # Each stands for just one character
5
>>> ord('\n')                # \n is a byte with the binary value 10 in ASCII
10
>>> S = 'A\0B\0C'            # \0, a binary zero byte, does not terminate string
>>> len(S)
5

Untitled

Bhavuk kumar
Module by Bhavuk kumar, updated more than 1 year ago
No tags specified