Skip to main content

Posts

Showing posts with the label Python

How to learn Python without computer?

  How to learn Python without computer? The best way to learn any programming language is to do practice on writing the code and debug the on self. Image Source:  Real Python In some cases we don't have computer/good computer to learn/practice, so how can we learn python without computer ? You can take any Python books from Library or from your friend and starting learning it. - Does this help me to get python skills?  No Dear, as I said at the top practice is the way to learn programming . I don't have a computer to practice? It's Okay if really you are interested  to learn python just use your Smart Phone . Go to play store  and download the Offline Python IDE and starting writing your 'Hello World !' and run the code and see the output.😇. Then step by step start to learn more day by day and practice in mobile.  After you learn something about python, just start to build apps using your mobile phone only. Yes, don't think to build Instagram or Netflix li...

Everything About Python For Beginners

Everything About Python For Beginners  Hi Beginners, Welcome To Google Bird   Start Of Python   How to start? Important Topics in Python For Beginners to Look for  Tuples in Python Lists in Python Sets in Python Set Operations in Python Dictionaries in Python Conditional Statements in Python If statements Looping Concepts General Topics In Python Class and Objects In Python Variables in Python Keywords in Python Functions in Python Input Operations in python Getting Input from the User keyboards using Python Getting Multiple inputs from the user keyboards using Python Example Programs using Python You should Know Fibonacci Series using Python Factorial Programs using Python Recursion Using Python Counting No Of digits in Given Number Using Python Given Number is Prime or not Using Python Reversing Of given Number using Python Reversing of given String Using Python Regex in Python What is Regex? Wh...

Python #26-Extract Domain Name From Mail Id Using Python Regex

Let's assume a task which has been given your boss or teacher or staff's. (i.e) Get domain name of the email address of the students in the class or the employee's in the office. Tips :  Get all characters next to @ symbol . Source Code: import re variable=re.findall(r"@\w+", "dharani@gmail.com,  dharan@googlebird.in,  mymail@bird.com, dd@facebook.com")  print variable Output: F:\Knowledge\Python\LearningProgramsOwn>Domain.py ['@gmail', '@googlebird', '@bird', '@facebook'] Explanation : import regular expression. re.findall(r"@\w+", "values@domain.com")  - This line is used to extract the values from the mail address and store in on the variable. Which is an Regex Operation which we learn Previously .  Print the variable. To know  What is Python Regex ? what are the application of Regex? Thanks and regards, Tech Bird ...

Python #25-Application of Regular Expressions

Previous Post :                                  Python #24-Reversing Of Given String Next Post        :                                  Coming Soon... Tips :  To get each character from the word use "." Source Code : import re result=re.findall(r".", "I AM BIG FAN OF SACHIN") print result Output: ['I', ' ', 'A', 'M', ' ', 'B', 'I', 'G', ' ', 'F', 'A', 'N', ' ', 'O', 'F', ' ', 'S', 'A', 'C', 'H', 'I', 'N'] Note Worthy : If you notice the output space is also present, in order to remove use "\w" instead of ".". _________________________________________________ Tips : To get each character from the word use "\w" without space " " in output. Source Code :  import re result=re.findall(r"\w", ...

Python #24-Reversing of Given String

Previous Post:                            Python #23-Regex findall() and sub() in Python Next Post      :                           Coming soon... Source Code:  variable1 = str(input("Enter the String to be reversed : "))  print "Before Reversing : ", variable  variable2 = (variable[::-1])  print "After Reversing: ", variable2 Output:   Enter the String to be reversed : Dharani   Before Reversing : Dharani   After Reversing : inarahD Explanation:   Get the Input from the user.   Using String slicing operation [::value] the list is revered. Here -1 is used because from the last the values will be taken.   Print the output. User also seen : Reversing of the Given number  Compile Your code COMPILE NOW Thanks and regards, Tech bird

Python #23-Regex findall() and sub() in Python

Previous Post   :                            Python #22-Regex match() and search() in Python Next Post         :                            Coming soon........ re.findall(): It find all sub strings where the RE matches, and return them as a list. This function is used to catch all the matching patterns in the strings. Note Worthy: re.match() + re.search() = re.findall() Syntax:   re.findall(pattern, string) Source Code:   import re   variable = re.findall(r"Google", "Google Bird learn around Google and gives the best contents to the viewrs")   print variable Output:    ['Google', 'Google'] re.sub(): This is used to search a pattern in the string an replace with the new sub string. Syntax: re.sub(pattern, replac...

Python #22-Regex match() and search () in Python

Previous Post     :                                   Python #21-Regex in Python Next Post           :                                   Python #23-Regex findall() and substring() methods in Python Regex methods in Python In Python re module consists of regular expression methods. re.match() re.search() re.findall() re.match() : This method finds match if it occurs at starting position of the string. For eg: calling match() on the string "Google Bird" and looking for "Google" will match. In case if your are going to look for Bird it will not match because match() will only recognize only the starting position of the string. Syntax: re.match(pattern, string) Source Code:   import re   variable = re.match(r"Google", ...

Python #21-Regular Expression in Python

Previous Post     :                                 Python #20-Given number is prime or not Next Post            :                                 Python #22-Regex match() and search() methods in Python What is Regex? Regex - Regular Expression Regular Expression are a special purpose text string operation used in programming language for search pattern. Primarily used for String searching and manipulation. For eg: If you need to find a certain word from a word document or log file this method might be handy for the programmers. Note Worthy: In Python, Regular Expression is denoted by Re and its is imported from the module re module. Methods that can used in Regular Expressions: re.split() re.match() re.search() re.findall() Simple Example of Regex ...

Python #20-Given number is Prime or Not

Previous Post    :                                 Python #19-Reversing of the given Number Next Post          :                                 Python #21-Regex in Python What are prime number ? Prime number are those when a number is divided by same number or then by 1 it should give you the remainder as Zero. Eg: 2, 3, 5, 7, 11, 13, 17, 19 Note Worthy: 0 and 1 are not prime numbers. The 2 is the only even prime number because all the other even numbers can be divided by 2. Source Code: number  =  int(input("Enter the number to check prime or not:")) if number > 1:    for i in range(2, number):       if (number % i) == 0:            print number, "is not a prime number"       ...

Python #19-Reversing of the given number

Previous Post   :                             Python #18-Counting the number of digits in the given number Next Post         :                             Python #20-Given number is Prime or Not Reversing of the given number Eg: 54321       The reversing of the given number will be 12345 Source Code: number  = int (input("Enter the number to reverse: ")) rev = 0 while(number > 0):     r =  number % 10     rev = (rev * 10)+r     number =  number / 10 print "Reversed of the given number is :", rev Output:    Enter the number to reverse: 54321    Reversed of the given number is : 12345 Explanation:   1. Getting the number to be reversed from the user by using input().   2. Initializing...

Python #18-Counting the Number of Digits in a given Number

Previous Post  :                             Python #17-To print the multiplication Table of a given number Next Post         :                             Python #19-Reversing the given number Counting the number of digits in a number Eg: 9876543210           This number consists of 10 digits. Source Code: number = int (input("Enter the number to count the digits:")) counter = 0 while (n>0):      counter = counter + 1      number = number / 10 print "The number of digits in the given number is:", counter Output:     Enter the number to count the digits: 9876543210     The number of digits in the given number is : 10 Explanation:    1. Getting the number from the user keyboard by using the inpu...

Python #17-To Print Multiplication Tables of a Given Number

Previous Post :                             Python #16-Getting Multiple Inputs In Python Lists Next Post       :                             Python #18-Counting the Number of Digits in a Number Tables:   2 X 1 =2        2 X 2 =4 2 X 3 =6 2 X 4 =8 2 X 5 =10 2 X 6 = 12 2 X 7 = 14 2 X 8 = 16 2 X 9 = 18 2 X 10 =20 Come let's Try this in Python.. Source Code:   number = int(input("Enter the number to print its table :")) mul = 'X' equal = '=' if(number != 0):     for i in range (1, 11):        print number, mul, i, equal, number*i else :    print "Zero X anything will be Zero" Output: Test case 1:     Enter the number to print its table: 2     2 X 1 =2            2 X 2 =4 ...

Python #16-Getting Multiple Inputs in Python Lists

Previous post :                             Python #15-How to get User input in Python  Next Post       :                             Python #17-To print the multiplication Table of a given number                                                           While reading the previous post : Python #15-How to get user input in python we people might get an doubt how to get the multiple inputs in Python like we used to fetch in java or c or c++  and store in array by getting how many inputs the user is going to give to console to perform operation.. Here is the post for the those people who got those doubt and also for those who not got those doubts. Keep...

Python #15-How to get user input in Python

Previous post      :           Python #14-Let's Play with Python part-2 Factorial of given number               Next Post              :           Python #16-Getting Multiple Inputs in Python Lists raw_input(): raw_input() is the python inbuilt function which is used to get the input from the keyboard. Such that raw_input get the inputs as in string and perform the operation consider the inputs as a string. Syntax:      variableName = raw_input("Print statement you wish to show to the user:") Example:       name=raw_input("Enter your name:")       print "Name%s" %name Output:       Enter your name: Dharanidharan V       Dharanidharan V Explanation:     Line 1: name=raw_input("Enter your name:")         ...

Python #14-Let's Play with Python part-2-Factorial of given number

Previous post:                                                                                                                                         Next post: Python #13-Let's Play with Python part-1-Fibonacci Series              Python #15-How to get user input in python Factorial of a given number in Python: What is Factorial of a  number? The product of an integer and all the integer below it. Example: Note: Use 🖉 to edit the code. Use ▶ to view the output. Explanation: Line 3 : fact=1               Declaring variable fact and assigning va...

Python #13-Let Play with Python part-1-Fibonacci series

Previous post:                                                                                                                                    Next Post:          Python #12-Recursion functions in Python             Python #14-Let's Play with Python part-2-Factorial of a number Have you think how to do Fibonacci series in python? while reading my blog... Then right you are right track on learning from google bird fun learn... Fibonacci series: a series of numbers in which each number(Fibonacci series) is the sum of the two preceding numbers. The simplest is the series 1, 1, 2, 3, 5, ...