Skip to main content

Posts

Showing posts from October, 2017

Python #27 - Replace Of a Given String Using Python

Aim :  To replace the given string using the alternative string using python Source Code: stringvariable=raw_input("Enter a string :") stringvariable=stringvariable.replace("a", "@") stringvariable=string.replace("A", "@") print("After Replace:") print(stringvariable) Output: Enter a string: Orange After Replace: Or@nge Explanation : The replace function replaces all occurrences of  "a" and "A" to "@" and store it back in the variable Also Seen :  How to Extract Domain From Mail id Using Python What are the applications of Regex? What is Regex? Thanks and regards, Google Bird

" Delete for Everyone " - WhatsApp New features Rolling Out

WhatsApp message delete/ recall feature has been in the rumour  that lets users delete messages they’re already sent. . Finally got with an meaning full roll outs. But fans will be pleased to know that the feature, which had not made an official appearance so far, has started trickling out to some WhatsApp users. This features is named 'Delete for Everyone', has started rolling out to some users on Android, iPhone, and Windows Phone apps.  Note Worthy : It only works if both the recipient and sender have the latest version of WhatsApp installed, the site notes, and it also works on Web version. Point to Look at : WhatsApp users will be able to delete messages that they have either sent to a group or an individual chat. Messages that have been successfully deleted in a chat will be replaced by “this message was deleted”. Users are only able to delete messages within seven minutes of sending it. From the Developers : Deleting messages for eve

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

C #7-Sorting of Elements in an Array

Source Code: #include <stdio.h> void main() {     int arr[30];     int i, j, num, temp;     printf("Enter the number of values to be taken in array \n");     scanf("%d", &num);     printf("Enter the elements to array\n");     for (i = 0; i < num; i++)     {         scanf("%d", &arr[i]);     } //Sorting Operation Starts     for (i = 0; i < num; i++)     {         for (j = 0; j < (num - i - 1); j++)         {             if (arr[j] > arr[j + 1])             {                 temp = arr[j];                 arr[j] = arr[j + 1];                 arr[j + 1] = temp;             }         }     }     printf("After Sorting :\n");     for (i = 0; i < num; i++)     {         printf("%d\n", arr[i]);     } } Output: D:\D INSTALL\TDM-GCC-32\Programs>gcc Sorting.c -o Sort.exe D:\D INSTALL\TDM-GCC-32\Programs>sort.exe Enter the number of values to be taken in array

C #6-Concatenation of Two String without using Strcat()

Source Code: #include <stdio.h> int main() {     char a[30], b[30], i, j;     printf("Enter first string: ");     scanf("%s", a);     printf("Enter second string: ");     scanf("%s", b);     for(i = 0; a[i] != '\0'; ++i);     for(j = 0; b[j] != '\0'; ++j, ++i)     {         a[i] = b[j];     }     a[i] = '\0';     printf("After concatenation: %s", a);     return 0; } Output: D:\D INSTALL\TDM-GCC-32\Programs>Concatstr.exe Enter first string: dharani Enter second string: dharan After concatenation: dharanidharan Also see: Reversing of Number using C Program Palindrome Number or not using C Program Thanks and Regards, Tech Bird

Top 10 C Interview Programs asked in MNC's

Dated : 24-Oct-2017 #1: Swap two numbers (without using a temporary variable) in c #2: Patterns program in c #3: Finding the Fibonacci Series of the given Number in c #4: Armstrong number in c #5: Concatenate two strings without using strcat() in c #6: Sort elements of an array in c #7: Find the second largest elements in array using c  #8: Reversing of Number in c #9: Add two numbers using Command line arguments in c #10: Palindrome Number or Not  Thanks and regards, Tech Bird

To check Whether the given number is Perfect number or Not

Source Code: #include <stdio.h> #include<stdlib.h> int main(int argc, char const*argv[]) {     int i, n;     n=atoi(argv[1]);     for(i = 0; i <= n; i++)     {         if (n == i * i)         {             printf("YES");             return 0;         }     }     printf("NO");     return 0; } Output: D:\D INSTALL\TDM-GCC-32\Programs>Perfect 4 YES D:\D INSTALL\TDM-GCC-32\Programs>Perfect 5 NO D:\D INSTALL\TDM-GCC-32\Programs>Perfect 100 YES Users Also Seen : How to use Command Line arguments in C Add two numbers using Command Line Arguments in C Thanks and regards, Tech Bird

Add two numbers using Command line arguments in c

Source Code: #include<stdio.h> #include<stdlib.h> void main(int argc , char * argv[]) {     int i,sum=0;     if(argc!=3)       {       printf("you have forgot to type numbers.");       exit(1);       }     printf("The sum is : ");     for(i=1;i<argc;i++)         sum = sum + atoi(argv[i]);     printf("%d",sum); } Output: D:\D INSTALL\TDM-GCC-32\Programs>add 2 4 The sum is : 6 D:\D INSTALL\TDM-GCC-32\Programs>add 5 4 The sum is : 9 Check Here: How to Use Command Line Arguments in C  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",

Convert Binary Number to Decimal Number Using Command Line Arguments

Source Code: #include <stdio.h> #include<stdlib.h> void main(int argc, char const*argv[]) {     long  number, binary, decimal= 0, base = 1, remainder;               number = atoi(argv[1]);      while (number > 0)     {         remainder = number % 10;         decimal = decimal + remainder * base;         number = number / 10 ;         base = base * 2;     }     printf("%ld", decimal); } Output: User Also Seen : Convert Decimal To Binary Number    Thanks and regards, Tech Bird

Convert Decimal Number to Binary Number Using Command Line Arguments

Source Code: #include <stdio.h> #include<stdlib.h> void main(int argc, char const*argv[]) {     long number, remainder, base = 1, binary = 0 ;     number = atoi(argv[1]);     while (number > 0)     {         remainder = number % 2;                       /* separate Last digit from number */         binary = binary + remainder * base;         number = number / 2;                              /* remove Last digit from num */         base = base * 10;     }     printf("%ld", binary); } Output: User Also Seen : Convert Binary To Decimal Number Thanks and regards, Tech Bird

Count The Number of Odd Digits in the Given Integer Using Command Line arguments

Note: Remove the Red color Highlighted Lines such that it works as a code for Odd digits.. Source Code: #include<stdio.h> #include<stdlib.h> void main(int argc, char const*argv[]) {  int oddCount = 0, evenCount = 0, InputNum, temp ; InputNum = atoi(argv[1]);  while (InputNum> 0)         {              temp = InputNum % 10;                         /* separate Last digit from number */               if (temp % 2 == 1)                 {                   oddCount++;                  }               else                   {                   evenCount++;                   }                    InputNum /= 10;                      /* remove Last digit from num */          } printf("Number of Odd digits : %d \ nNumber of Even digits: %d\n ", oddCount, evenCount ); } Output: Also See : Count No Of Odd and Even Digits  Thanks and regards, Tech Bird

Count The Number of Odd and even Digits in the Given Integer Using Command Line arguments

Source Code: #include<stdio.h> #include<stdlib.h> void main(int argc, char const*argv[]) {  int oddCount = 0, evenCount = 0, InputNum, temp ; InputNum = atoi(argv[1]);  while (InputNum> 0)         {              temp = InputNum % 10;                         /* separate Last digit from number */               if (temp % 2 == 1)                 {                   oddCount++;                  }               else                   {                   evenCount++;                   }                    InputNum /= 10;                      /* remove Last digit from num */          } printf("Number of Odd digits : %d \nNumber of Even digits: %d\n", oddCount, evenCount); } Output: Thanks and regards, Tech Bird

Share Your Gmail Without Telling Your Password

Do You Know ? You can able to share your gmail with others without telling your passwords. With giant Google Gmail's features. It allows us to grant permission to someone access to your account without revealing your password.  Yes , It's True. Note Worthy :         "    You can add 10 people's    " What that people can do? Can Read, Send and Delete messages in your Gmail account.  When they are going to send a mail from your account their email address as well appear in the message. Don't worry They cannot able to change any of your settings including your passwords and even cannot able to chat with your fellow beings. How to make this work for my account ? Open Your Gmail   Go to  Settings > Accounts and Import. Under Grant access to your account, click A dd another account. Choose whether messages read by people are marked as read or not. When popes out, enter the email address of the people you wish to add

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, replacement_string, string ) Source Code:   import re   variable = re.sub(r"viewers","Learners to learn easily",  "Google Bird learn around Go

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", "Google Bird")   print variable.group(0) Note Worthy: Here in Line 2: "Google" is pattern which i want to search. "Google Bird" is the string  as per the Syntax..

See what people Search Across The Globe in Google - Right Now!

Do you Know  You can watch what people searching the google Search Box ? Yes , You can able to View What people search in Google Search Box.... Not believing Me.. See what people Search Across The Globe -  View Live See what Indians people Searching In the Google Right Now ! -  Live Preview Do You Know you can able to See the Stored Passwords of your android and Google? Yes, You can Show Me the Passwords . Don't Forget to Try this.... Go the Google Images And Search Atari Breakout   and See the Magic.. Lot More There search The words Below In Google and See the Magics.... blink html zerg rush Google in 1998 tilt do a barrel roll pacman Don't Forget to Follow Google Bird to Get More Tips and Tricks. Not Only Tips and Tricks @ google bird, We offer Learning Programming Too.. Python - Python Made Simple C - Learn C with Google Bird Mongodb - A Popular Data Base Learning Thanks and regards, Tech bird

YouTube Tricks You Should Know Before Using

Directly Download Audio From YouTube:  Kindly Delete " ube " in "youtube" and make as " yout " in the URL and click enter it in your address bar to download the audio of the video. For eg: https://www. youtube .com/watch?v=iHagLitT-nI&list=PLvK7fs0-FWq_0a3h-4Sbr4m56TAZZLFK0 https:// yout .com/playlist/?list=PLvK7fs0-FWq_0a3h-4Sbr4m56TAZZLFK0&v=iHagLitT-nI Directly Download Video From You Tube: Kindly Add " ss " before "youtube" and make like this " ssyoutube " in the URL and press enter in your address bar  to download the video in any quality available. Directly Convert the Video Snap into gif and Send to Your friends: Kindly Add" gif " before "youtube" and make like this " gifyoutube " in the URL  and press enter in your address bar to convert video into gif format . You Tube Shortcut key that might help you: K - To Play or Pause a Video. J  - To Rewind

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 in Python Syntax of split function: re.split('items to find and split', 'String in which operation to be performed') Eg:       re.split('\s', 'Hello world') item

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"            break    else:       print number, "is a prime number" else:      print number, "is not a prime number" Output:    Test case 1:       Enter a number : 10       10 is not a prime number Test case 2:       Enter a  number : 9

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 a variable rev=0.   3. Checking whether the given number is greater than Zero. If the condition is said to be true the while loops starts its function.   4. First creating a temp variable r and upcoming operation modules (i.e r = number

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 input().    2. Creating a variable name counter initializing it will zero.    3. Now checking whether the given number is greater than Zero using while()    4. If the number is greater than Zero, then the counter value will be incremented by 1

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     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 Test case 2:     Enter the number to print its table: 0     Zero X anything will be Zero Explanation:     1. Gettin

C #5-Reversing of Number using C Program

Previous Post:         C #4-Palindrome Number or not using C Program Next Post:   C #6-Reversing String Using String Program without using String function. Reversing of given Number Using C Source code:  #include<stdio.h>  void main()  {    int n, r, rev=0;    printf("Enter the number to Reverse :");    scanf("%d", &n);    while(n)       {         r=n%10;         rev=(rev*10)+r;         n=n/10;       }    printf("Reversed number : %d", rev);  } Output:     Enter the number to Reverse: 10     Reversed number : 01 Thanks and regards, Tech Bird