Programming Articles - Page 3013 of 3366

Speech Recognition in Python using Google Speech API

Samual Sam
Updated on 30-Jul-2019 22:30:23

2K+ Views

The speech recognition is one of the most useful features in several applications like home automation, AI etc. In this section we will see how the speech recognition can be done using Python and Google’s Speech API. In this case we will give an audio using microphone for speech recognizing. To configure the microphones, there are some parameters. To use this module, we have to install the SpeechRecognition module. There is another module called pyaudio, which is optional. Using this we can set different modes of audio. sudo pip3 install SpeechRecognition sudo apt-get install python3-pyaudio For External Microphones ... Read More

Birthday Reminder Application in Python

karthikeya Boyini
Updated on 30-Jul-2019 22:30:23

825 Views

In this section we will see how to create a birthday reminder application using Python. Problem Statement Create an application using Python, which can check whether there is any birthday on the current day or not. If it is the birthday of some listed person, send a notification to the System with the name of that person. We need a file, where we can store the date and month and the name of the person as a lookup file for this application. The file will look like this − Here we will convert this application to a start-up application ... Read More

Unix filename pattern matching in Python

Samual Sam
Updated on 26-Jun-2020 08:57:31

2K+ Views

Here we will see how we can get the UNIX shell style pattern matching techniques using Python. There is a module called fnmatch, which is used to do the work. This module is used to compare file name against a pattern, then returns True or False according to the matches.To use it at first we need to import it the fnmatch standard library module.import fnmatchIn the Unix terminal, there are some wildcards to match the patterns. These are like below −‘*’ The asterisk is used to match everything.‘?’ Question Mark is for matching a single character.[seq] Sequences are used to ... Read More

Initialization of variable sized arrays in C

karthikeya Boyini
Updated on 26-Jun-2020 08:59:10

7K+ Views

Variable sized arrays are data structures whose length is determined at runtime rather than compile time. These arrays are useful in simplifying numerical algorithm programming. The C99 is a C programming standard that allows variable sized arrays.A program that demonstrates variable sized arrays in C is given as follows −Example Live Demo#include int main(){    int n;    printf("Enter the size of the array: ");    scanf("%d", &n);    int arr[n];    for(int i=0; i

How to print a variable name in C?

karthikeya Boyini
Updated on 26-Jun-2020 09:00:16

1K+ Views

The following is an example to print variable name.Example Live Demo#include #define VariableName(name) #name int main() {    int name;    char ch;    printf("The variable name : %s", VariableName(name));    printf("The variable name : %s", VariableName(ch));    return 0; }OutputThe variable name : name The variable name : chIn the above program, the variable names are printed by defining the method before main()#define VariableName(name) #nameTwo variables of different datatypes are declared. By using the defined function, variable names are printed.int name; char ch; printf("The variable name : %s", VariableName(name)); printf("The variable name : %s", VariableName(ch));

Write a power (pow) function using C++

Samual Sam
Updated on 26-Jun-2020 09:02:50

2K+ Views

The power function is used to find the power given two numbers that are the base and exponent. The result is the base raised to the power of the exponent.An example that demonstrates this is as follows −Base = 2 Exponent = 5 2^5 = 32 Hence, 2 raised to the power 5 is 32.A program that demonstrates the power function in C++ is given as follows −Example Live Demo#include using namespace std; int main(){    int x, y, ans = 1;    cout > x;    cout > y;    for(int i=0; i

The static keyword and its various uses in C++

karthikeya Boyini
Updated on 26-Jun-2020 09:03:47

417 Views

When static keyword is used, variable or data members or functions can not be modified again. It is allocated for the lifetime of program. Static functions can be called directly by using class name.Static variables are initialized only once. Compiler persist the variable till the end of the program. Static variable can be defined inside or outside the function. They are local to the block. The default value of static variable is zero. The static variables are alive till the execution of the program.The following is the syntax of static keyword.static datatype variable_name = value; // Static variable    static ... Read More

C++ Program to Find Fibonacci Numbers using Iteration

Tapas Kumar Ghosh
Updated on 21-Apr-2025 18:06:34

9K+ Views

The term Fibonacci numbers is used in mathematics, which calculates the sum of two preceding numbers that starts from 0 and 1 and continues till based on the given number say num. Mathemathematically, it is represented by: Fn = Fn-1 + Fn-2 Let us take an example to understand the above formula based on fibonacci numbers. F0 = 0 F1 = 1 F2 = F1 + F0 = 1 + 0 = 1 F3 = F2 + F1 = 1 + 1 = 2 F4 = F3 + F2 = 2 + 1 = 3 ... Read More

C++ Program to Check Whether a Number can be Expressed as Sum of Two Prime Numbers

Tapas Kumar Ghosh
Updated on 09-Jun-2025 11:28:29

1K+ Views

You are given a number and you need to write a C++ program to check whether a number can be expressed as sum of two prime numbers. Input / Output Scenarios Following is the input-output statement: Input: n = 19 Output: 19 can be expressed as the sum of two prime numbers. Explanation: 19 = 17 + 2, and both 17 and 2 are prime numbers. Input: n = 36 Output: 36 can be expressed as the sum of two prime numbers. Explanation: 36 = 31 + 5, and both 31 and 5 are prime numbers. C++ Program ... Read More

C++ Program to Compute Combinations using Factorials

Samual Sam
Updated on 26-Jun-2020 08:39:33

990 Views

The following is an example to compute combinations using factorials.Example Live Demo#include using namespace std; int fact(int n) {    if (n == 0 || n == 1)    return 1;    else    return n * fact(n - 1); } int main() {    int n, r, result;    coutn;    coutr;    result = fact(n) / (fact(r) * fact(n-r));    cout

Advertisements