Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Python Tutorial For Beginners | Python Crash Course - Python Programming Language Tutorial | Edureka

857 views

Published on

** Python Certification Training: https://www.edureka.co/python **
This Edureka tutorial on "Python Tutorial for Beginners" (Python Blog Series: https://goo.gl/nKQJHQ) covers all the basics of Python. It includes python programming examples, so try it yourself and mention in the comments section if you have any doubts. Following are the topics included in this PPT:

Introduction to Python
Reasons to choose Python
Installing and running Python
Development Environments
Basics of Python Programming
Starting with code
Python Operators
Python Lists
Python Tuples
Python Sets
Python Dictionaries
Conditional Statements
Looping in Python
Python Functions
Python Arrays
Classes and Objects (OOP)
Conclusion

Follow us to never miss an update in the future.

Instagram: https://www.instagram.com/edureka_learning/
Facebook: https://www.facebook.com/edurekaIN/
Twitter: https://twitter.com/edurekain
LinkedIn: https://www.linkedin.com/company/edureka

Published in: Technology
  • DOWNLOAD FULL. BOOKS INTO AVAILABLE FORMAT, ......................................................................................................................... ......................................................................................................................... 1.DOWNLOAD FULL. PDF EBOOK here { https://tinyurl.com/y8nn3gmc } ......................................................................................................................... 1.DOWNLOAD FULL. EPUB Ebook here { https://tinyurl.com/y8nn3gmc } ......................................................................................................................... 1.DOWNLOAD FULL. doc Ebook here { https://tinyurl.com/y8nn3gmc } ......................................................................................................................... 1.DOWNLOAD FULL. PDF EBOOK here { https://tinyurl.com/y8nn3gmc } ......................................................................................................................... 1.DOWNLOAD FULL. EPUB Ebook here { https://tinyurl.com/y8nn3gmc } ......................................................................................................................... 1.DOWNLOAD FULL. doc Ebook here { https://tinyurl.com/y8nn3gmc } ......................................................................................................................... ......................................................................................................................... ......................................................................................................................... .............. Browse by Genre Available eBooks ......................................................................................................................... Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult,
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

Python Tutorial For Beginners | Python Crash Course - Python Programming Language Tutorial | Edureka

  1. 1. Python Certification Training https://www.edureka.co/python Agenda
  2. 2. Python Certification Training https://www.edureka.co/python Agenda Introduction 01 Introduction to Python Getting Started 02 Concepts 03 Practical Approach 04 Installing and working with Python Looking at code to understand theory Overview of the concepts in Python
  3. 3. Python Certification Training https://www.edureka.co/python Introduction to Python
  4. 4. Python Certification Training https://www.edureka.co/python Introduction to Python Open Source Python is a powerful high-level, object-oriented programming language created by Guido van Rossum. What is Python? Largest community for Learners and Collaborators Let’s get started then! I created Python! No. It wasn't named after a dangerous snake. Rossum was fan of a comedy series from late seventies. The name "Python" was adopted from the same series "Monty Python's Flying Circus".
  5. 5. Python Certification Training https://www.edureka.co/python Why is Python so popular?
  6. 6. Python Certification Training https://www.edureka.co/python Popularity Of Python Learning other languages Learning Python Python is very beginner-friendly! Hello Python! Syntax is extremely simple to read and follow! Millions of happy learners! I’m a happy coder!
  7. 7. Python Certification Training https://www.edureka.co/python Unique Features of Python
  8. 8. Python Certification Training https://www.edureka.co/python Features Of Python 0102 03 04 0506 07 Simple language - Easier to learnFree and Open-Source Portability Extensible and Embeddable Large Standard Libraries High Level – Interpreted Language Object Oriented You shall master Python!
  9. 9. Python Certification Training https://www.edureka.co/python Why should you learn Python?
  10. 10. Python Certification Training https://www.edureka.co/python Why Should You Learn Python? Length of the code is relatively short Python is a general-purpose language Wide range of applications Fun to work with! Web Development Mathematical Computations Graphical User Interface
  11. 11. Python Certification Training https://www.edureka.co/python 4 Reasons to Choose Python
  12. 12. Python Certification Training https://www.edureka.co/python Reasons to Choose Python as First Language We can fetch any number of reasons for you! a = 2 b = 3 sum = a + b print(sum) Why? The syntax feels natural. Simple Elegant Syntax Programming in Python is fun! It's easier to understand and write Python code
  13. 13. Python Certification Training https://www.edureka.co/python Reasons to Choose Python as First Language We can fetch any number of reasons for you! No need to define the type of a variable in Python Also, no semicolon at the end of the statement Not overly strict Phew, no more semicolon!!! Python enforces you to follow good practices (like proper indentation)
  14. 14. Python Certification Training https://www.edureka.co/python Reasons to Choose Python as First Language We can fetch any number of reasons for you! Python allows you to write programs having greater functionality with fewer lines of code Expressiveness of the language Woah Python <3 You will be amazed how much you can do with Python once you learn the basics
  15. 15. Python Certification Training https://www.edureka.co/python Python has a large supporting community Reasons to Choose Python as First Language We can fetch any number of reasons for you! Great Community and Support We have an amazing community with lots of videos, blogs and course certifications on Python!
  16. 16. Python Certification Training https://www.edureka.co/python Installing And Running Python
  17. 17. Python Certification Training https://www.edureka.co/python Installing And Running Python 6 very simple steps to install Python! Go to the official Python download page on the official site and click Download Python 3.6.0 When the download is completed, double-click the file and follow the instructions to install it. When Python is installed, a program called IDLE is also installed along with it. It provides graphical user interface to work with Python. To create a file in IDLE, go to File > New Window (Shortcut: Ctrl+N) Write Python code and save (Shortcut: Ctrl+S) with .py file extension Go to Run > Run module (Shortcut: F5) and you can see the output.
  18. 18. Python Certification Training https://www.edureka.co/python Development Environments
  19. 19. Python Certification Training https://www.edureka.co/python Development Environments There are a lot of environments you can use! Komodo IDE
  20. 20. Python Certification Training https://www.edureka.co/python Compiling v/s Interpreting
  21. 21. Python Certification Training https://www.edureka.co/python Compiling v/s Interpreting Python is directly interpreted into machine instructions! compile execute outputsource code Hello.java byte code Hello.class interpret outputsource code Hello.py I’m learning Python!
  22. 22. Python Certification Training https://www.edureka.co/python Basics of Python
  23. 23. Python Certification Training https://www.edureka.co/python Expressions Diving into the heart of Python! I’m learning Python! Expression: A data value or set of operations to compute a value. Examples: 1 + 4 * 3 42 Arithmetic operators we will use: • + - * / addition, subtraction/negation, multiplication, division • % modulus, a.k.a. remainder • ** exponentiation Precedence: Order in which operations are computed. • * / % ** have a higher precedence than + - 1 + 3 * 4 is 13 • Parentheses can be used to force a certain order of evaluation. (1 + 3) * 4 is 16
  24. 24. Python Certification Training https://www.edureka.co/python Math Commands Python has useful commands for performing calculations! I’m learning Python! Command name Description abs(value) absolute value ceil(value) rounds up cos(value) cosine, in radians floor(value) rounds down log(value) logarithm, base e log10(value) logarithm, base 10 max(value1, value2) larger of two values min(value1, value2) smaller of two values round(value) nearest whole number sin(value) sine, in radians sqrt(value) square root Constant Description e 2.7182818... pi 3.1415926...
  25. 25. Python Certification Training https://www.edureka.co/python Variables Variable is a named piece of memory that can store a value! I’m learning Python! • Usage: – Compute an expression's result, – store that result into a variable, – and use that variable later in the program. Assignment statement: Stores a value into a variable. • Syntax: name = value • Examples: x = 5 gpa = 3.14 • A variable that has been given a value can be used in expressions. x + 4 is 9
  26. 26. Python Certification Training https://www.edureka.co/python Basic Datatypes Many datatypes to choose from in Python! I’m learning Python! Integers (default for numbers) z = 5 / 2 # Answer 2, integer division Floats x = 3.456 Strings Can use “” or ‘’ to specify with “abc” == ‘abc’ Unmatched can occur within the string: “matt’s” Use triple double-quotes for multi-line strings or strings than contain both ‘ and “ inside of them: “““a‘b“c”””
  27. 27. Python Certification Training https://www.edureka.co/python Whitespaces Whitespace is meaningful in Python: Especially indentation and placement of newlines I’m learning Python! Use a newline to end a line of code Use when must go to next line prematurely No braces {} to mark blocks of code, use consistent indentation instead •First line with less indentation is outside of the block •First line with more indentation starts a nested block Colons start of a new block in many constructs, e.g. function definitions, then clauses.
  28. 28. Python Certification Training https://www.edureka.co/python Comments Comments help us understand the code better! I’m learning Python! Start comments with #, rest of line is ignored Can include a “documentation string” as the first line of a new function or class you define Development environments, debugger, and other tools use it: it’s good style to include one. #ImAComment
  29. 29. Python Certification Training https://www.edureka.co/python Assignment So how do you put some value in a variable? I’m learning Python! Binding a variable in Python means setting a name to hold a reference to some object Assignment creates references, not copies! Names in Python do not have an intrinsic type, objects have types Python determines the type of the reference automatically based on what data is assigned to it You create a name the first time it appears on the left side of an assignment expression: x = 3 A reference is deleted via garbage collection after any names bound to it have passed out of scope. Python uses reference semantics (more later)
  30. 30. Python Certification Training https://www.edureka.co/python A Quick Break! Python and it’s big players around the world!
  31. 31. Python Certification Training https://www.edureka.co/python Naming Rules Watch out for reserved words! I’m learning Python! Names are case sensitive and cannot start with a number. They can contain letters, numbers, and underscores. bob Bob _bob _2_bob_ bob_2 BoB There are some reserved words: and, assert, break, class, continue, def, del, elif, else, except, exec, finally, for, from, global, if, import, in, is, lambda, not, or, pass, print, raise, return, try, while
  32. 32. Python Certification Training https://www.edureka.co/python Naming Conventions We have 3 recommended conventions I’m learning Python! The Python community has these recommended naming conventions • joined_lower for functions, methods and, attributes! • joined_lower or ALL_CAPS for constants! • StudlyCaps for classes! Attributes: interface, _internal, __private
  33. 33. Python Certification Training https://www.edureka.co/python Assignment – An Easier Way? Less of typing means more of coding! I’m learning Python! You can assign to multiple names at the same time >>> x, y = 2, 3 >>> x 2 >>> y 3 This makes it easy to swap values >>> x, y = y, x Assignments can be chained >>> a = b = x = 2
  34. 34. Python Certification Training https://www.edureka.co/python Accessing Non-Existent Names Let’s see how we can raise an error! I’m learning Python! Accessing a name before it’s been properly created (by placing it on the left side of an assignment), raises an error >>> y Traceback (most recent call last): File "<pyshell#16>", line 1, in -toplevel- y NameError: name ‘y' is not defined >>> y = 3 >>> y 3
  35. 35. Python Certification Training https://www.edureka.co/python Casting We can explicitly convert based on requirement I’m learning Python! Casting in python is therefore done using constructor functions: •int() - constructs an integer number from an integer literal, a float literal (by rounding down to the previous whole number), or a string literal (providing the string represents a whole number) •float() - constructs a float number from an integer literal, a float literal or a string literal (providing the string represents a float or an integer) •str() - constructs a string from a wide variety of data types, including strings, integer literals and float literals
  36. 36. Python Certification Training https://www.edureka.co/python Casting We can explicitly convert based on requirement I’m learning Python! x = int(1) # x will be 1 y = int(2.8) # y will be 2 z = int("3") # z will be 3 x = float(1) # x will be 1.0 y = float(2.8) # y will be 2.8 z = float("3") # z will be 3.0 w = float("4.2") # w will be 4.2 x = str("s1") # x will be 's1' y = str(2) # y will be '2' z = str(3.0) # z will be '3.0' Told you Python is real easy!
  37. 37. Python Certification Training https://www.edureka.co/python Let’s Code
  38. 38. Python Certification Training https://www.edureka.co/python Python Operators
  39. 39. Python Certification Training https://www.edureka.co/python Arithmetic Operators We can perform common math operations easily! I’m learning Python! Operator Name Example + Addition x + y - Subtraction x – y * Multiplication x * y / Division x / y * Modulus x % y ** Exponentiation x ** y // Floor Division x // y
  40. 40. Python Certification Training https://www.edureka.co/python Assignment Operators We can assign values to variables easily! I’m learning Python! Operator Example Same As = x = 5 x = 5 += x += 3 x = x + 3 -= x -= 3 x = x – 3 *= x *= 3 x= x * 3 &= x &= 3 x = x & 3 >>= x >>= 3 x = x >> 3 <<= x <<= 3 x = x <<3
  41. 41. Python Certification Training https://www.edureka.co/python Comparison Operators We can compare two values easily! I’m learning Python! Operator Name Example == Equal x == y != Not Equal x != y > Greater Than x > y < Less Than x < y >= Greater than or equal to x >= y <= Less than or equal to x <= y
  42. 42. Python Certification Training https://www.edureka.co/python Logical Operators Can we combine conditional statements? Yes, we can! I’m learning Python! Operator Description Example And Returns True if both statements are true x < 5 and x < 10 Or Returns True if one of the statements is true x < 5 or x < 4 Not Reverse the result, returns False if the result is True not(x , 5 and x < 10)
  43. 43. Python Certification Training https://www.edureka.co/python Identity Operators Compare objects, not to check if they are equal but to check if they are the same object I’m learning Python! Operator Description Example is Returns True if both variables are same object x is y is not Returns True if both variables are not same object x is not y
  44. 44. Python Certification Training https://www.edureka.co/python Bitwise Operators Let’s compare binary numbers and operate on them! I’m learning Python! Operator Name Description & AND Sets each bit to 1 if both bits are 1 | OR Sets each bit to 1 if one of two bits are 1 ^ XOR Sets each bit to 1 if only one of two bits in 1 ~ NOT Inverts all the bits << Zero fill left shift Shift left by pushing zeros in from the right and let the leftmost bits fall off >> Signed right shift Shift right by pushing copies of leftmost bit in from the left and let the rightmost bits fall off
  45. 45. Python Certification Training https://www.edureka.co/python Python Lists – Back to Code!
  46. 46. Python Certification Training https://www.edureka.co/python List Methods Python has a set of built-in methods that you can use! I’m learning Python! Method Description append() Adds an element at the end of the list clear() Removes all the elements from the list copy() Returns a copy of the list count() Returns the number of elements with the specified value extend() Add the elements of a list to the end of the current list index() Returns the index of the first element with the specified value insert() Adds an element at the specified position pop() Removes the element at the specified position remove() Removes the item with the specified value reverse() Reverses the order of the list sort() Sorts the list
  47. 47. Python Certification Training https://www.edureka.co/python Python Tuples – Back to Code!
  48. 48. Python Certification Training https://www.edureka.co/python Tuple Methods Python has two built-in methods you can use on tuples! I’m learning Python! Method Description count() Returns the number of times a specified value occurs in a tuple index() Searches the tuple for a specified value and returns the position of where it was found
  49. 49. Python Certification Training https://www.edureka.co/python Python Sets – Back to Code!
  50. 50. Python Certification Training https://www.edureka.co/python Set Methods Python has two built-in methods you can use on tuples! I’m learning Python! Method Description add() Adds an element to the set clear() Removes all the elements from the set copy() Returns a copy of the set difference() Returns a set containing the difference between two or more sets difference_update() Removes the items in this set that are also included in another specified set discard() Remove the specified item intersection() Returns the intersection of two other set issubset() Returns whether another set contains this set or not pop() Removes an element from the set
  51. 51. Python Certification Training https://www.edureka.co/python Python Dictionaries – Back to Code!
  52. 52. Python Certification Training https://www.edureka.co/python Dictionary Methods Python has a set of built-in methods you can use on dictionaries I’m learning Python! Method Description clear() Removes all the elements from the dictionary copy() Returns a copy of the dictionary fromkeys() Returns a dictionary with specified keys and values get() Returns the value of the specified key items() Returns a list containing the tuple for each key value pair keys() Returns a list containing the dictionary's keys update() Updates the dictionary with specified key-valu pairs pop() Removes an element from the dictionary
  53. 53. Python Certification Training https://www.edureka.co/python Condition Statements – More Code!
  54. 54. Python Certification Training https://www.edureka.co/python Looping In Python – Easy Code!
  55. 55. Python Certification Training https://www.edureka.co/python Python Functions – Easier Than You Think!
  56. 56. Python Certification Training https://www.edureka.co/python Arrays – Simple And Straightforward!
  57. 57. Python Certification Training https://www.edureka.co/python Array Methods Python has a set of built-in methods you can use on lists/arrays! I’m learning Python! Method Description clear() Removes all the elements from the array copy() Returns a copy of the array count() Returns the number of elements with the specified value insert() Adds an element at the specified position pop() Removes an element at the specified position remove() Removes the first item with the specified value reverse() Reverses the order of the array sort() Sorts the array
  58. 58. Python Certification Training https://www.edureka.co/python Classes & Objects – OOP (Code Again!)
  59. 59. Python Certification Training https://www.edureka.co/python Modules – Last Concept For The Session!
  60. 60. Python Certification Training https://www.edureka.co/python Conclusion
  61. 61. Python Certification Training https://www.edureka.co/python Conclusion

×