Skip to main content

Posts

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 ev...

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;             ...

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", ...