Wednesday, May 15, 2024

How-to-distribute-a-python-application-professionally

Link  

Syllabus of core Python

 

  • Python installation

  • The Command Line

  • Jupyter Notebook

  • Python Comments

  • The print statement

  • Variables

  • Constants

  • Keywords

  • Numbers

  • Strings

  • Lists

  • Dictionaries

  • Tuples

  • Sets

  • Control Flow

  • IF, ELIF and ELSE statements

  • Comparison operators

  • For loops

  • While Loops

  • Nest Loops

  • Break, Continue and Pass keywords

  • enumerate

  • List Comprehensions

  • Dictionary Comprehensions

  • How to use Functions

  • How to create your own Functions

  • Parameters and arguments

  • *args and **kwargs

  • lambda expressions

  • Map and Filter functions

  • Python Scope

  • Accepting and validating user input

  • Object Oriented Programming (OOP)

  • Inheritance

  • Polymorphism

  • Special Methods

  • Modules & Packages

  • How to create your own packages

  • Errors and Exceptions handling

  • Decorators

  • Generators

  • Web Scraping using the requests and BeautifulSoup libraries

  • GUI's using Tkinter

  • Dashboards using plotly and dash

  • Work with CSV files, PDF files and Databases

  • The Collections module

  • Regular Expressions (regex)

  • Timing your Python Code

Friday, April 26, 2024

Sacred Thought

5 May 2024

Hari Om

Verse 50-51, chapter two: 

In this chapter two Shree krishna explains a simple way of living.


Free from desires and void of possessions, go on efficiently doing your duties with evenness of mind

in their success or failure. Strive for the practice of this yoga of equanimity, possessing equipoised

mind you will attain the blissful supreme state. 


Hari Om Tat Sat!


----------------------------------------------------------------------------------------------------------------------

30 April 2024

Verse 38-53 chapter two simplified:


Practice yoga of mind as you perform your daily duties. 


Yoga of mind is being even-minded in both success (completion) and failure in what ever task you do. 


Try your best to do it in the best possible way, but if you don't succeed in it then don't get upset or unhappy.

 

Don't get too much happy by success nor get too sad by failures. Soon you will reach a state of mind

where success and failure won't affect you much.


Thus by being steady and undistracted by worldly affairs, you will attain Yoga - Everlasting Union with God!

----------------------------------------------------------------------------------------------------------------

28 April 2024


Today I am going to explain verse 31 - 38 chapter two for you all.


There is no opportunity better than a righteous war (सत्य और न्याय की लड़ाई ). So, always fight for the truth in your life. 

There are only two possible out comes of this war. Either you win or you lose. If you win, then what to say, 

you will rule the world but in case even if you lose(die), you will attain heaven after death.


So its a win-win situation. Never miss such opportunity to fight for what is right in your day to day life. Come 

forward and fight. As there are only two possible out comes, and you win in either case.


चुप ना रहो, हमेशा सत्य और न्याय के लिए लड़ो , फिर वो किसी के लिए भी क्यों ना हो।  अन्याय और जुर्म का साथ मत दो ना ही  उसे सहो |


------------------------------------------------------------------------------------------------------------------------


26 April 2024

 Dear friends, I write the explanation of two verses of Geets for all of you, I hope you all will like it and benefit from it.  


In Shreemad Bhagwat Geeta , the song celestial, one full chapter (chapter 16) has been devoted towards explaining the differences between the two tendencies within an individual, the good and evil, the divine and demoniac. 


Verse 3 indicates divine virtues: Splendor, forgiveness, fortitude, purity, absence of malice, absence of pride, these all are the qualities of those endowed with divine virtues.


Verse 4 indicates demoniac virtues: Hypocracy, arrogance, pride, anger, harshness, and ignorance are the marks of the one who is born of demonical properties. 


Even one of these divine virtues, say for example 'purity', attained by an individual will impart in him the remaining virtues rather automatically and make him a blissful person. 


On the other hand any of the demonical properties like 'anger' will bring him miseries in plenty and will lead to his utter downfall.


Needless to say you should adopt to more and more of divine virtues in your day to day life to attain bliss. 

---------------------------------------------------------------------------------------------------------------

27 April 2024

Good morning friends, today I write the explain of verse 12 of chapter 12 "The yoga of Devotion" to you all,
as given in Geeta - The Song Celestial.
 
The meaning of the verse is : 

"Better indeed is knowledge than practice, better than knowledge is
meditation, better than meditation is the renunciation of fruits of action, peace immediately follows
renunciation".

This verse teaches us the way to obtain peace while carrying out our duties and other activities.
The first step is that I should know the purpose behind my action. This is knowledge and this knowledge
is better than just practicing an action without knowing the purpose. 

The second step is that it is even better that in all my actions my mind should be totally concentrated on my actions.
Such action become perfect and perfection in action is meditation.

The third and supreme step is that I must not expect any fruits or benefits from my actions. This is renunciation
and it is this supreme attitude that gives me peace. I just carry out my duties to the best of my ability and 
offer the fruits of my action whether success or failure at the lotus feet of the Lord. This will give me peace
and happiness. 

This is Karma Yoga, you must perform selfless action with devotion to reach the Supreme.

निःस्वार्थ कर्म ही एक मात्रा सच्चे एवं स्थायी  सूख की कुंजी है | 
--------------------------------------------------------------------------------------------------------------------

Sunday, March 10, 2024

Basic Trubo C++ programs

/*

A C++ program to accept ten numbers in ascending order using array.

and search for a number given by user using binary search method.

*/


#include<iostream.h>

#include<conio.h>


void main()

{ clrscr();


 //Declare all variables.

 int arr[10], i, initial, final, mid, data;


 cout<<"Enter 10 numbers in ascending order ";


 for( i = 0; i<10; i++)

 {

   cin >> arr[i];

 }


 cout<<"\nEnter the data to be searched : ";


 cin >> data;


 initial = 0;


 final = 9;


 mid = (initial + final)/2;


 while( initial <= final) && (arr[mid] != data))

 {

if( arr[mid] > data)

final = mid - 1;

else

initial = mid + 1;

 }


 if( arr[mid] == data)

cout<<"Data is present";


 if(initial > final)

cout<<"Data is not present in the list";


 getch();


}


---------------------------------------------------------------------------------------------------------------


/*

A C++ program to accept 10 numbers in an array and sort the numbers

in ascending order using Bubble sort method. Practical 15.

*/


#include<iostream.h>

#include<conio.h>


void main()

{ clrsrc();


 //Declare all variables.

 int arr[10], i, j , temp;


 cout<<"Enter 10 numbers ";


 for( i = 0; i<10; i++)

cin>> arr[i];


 //Bubble sort.

 for( i = 0; i <10; i++)

 { 

for(j = 0; j<10; j++)

    {

if( arr[j] > arr[j +1])

{

//swap the two.

temp = arr[j];

arr[j] = arr[j+1];


   arr[j+1] = temp;

}

}

 }


 cout<<"The sorted array is \n";


 for( i =0; i < 10; i++)

cout<< arr[i]<<" ";


 getch();


}


-------------------------------------------------------------------------------------------------------------

/*

A C++ program to accept 10 numbers in an array and sort the numbers

in ascending order using Selection sort method.

*/


#include<iostream.h>

#include<conio.h>


void main()

{ clrsrc();


 //Declare all variables.

 int arr[10], i, j, temp;


 //prompt user to enter 10 numbers.

 cout<<"Enter any 10 numbers ";


 //Store the numbers in an array.

 for( i =0; i<10; i++)

  cin >> arr[i];


 //Selection sort.

 for( i = 0; i <10; i++)

 { 

for(j = 0; j<10; j++)

    {

if( arr[i] > arr[j])

{

//swap the two.

temp = arr[i];

arr[i] = arr[j];


   arr[j] = temp;

}

}

 }


 cout<<"The sorted array is \n";


 for( i =0; i < 10; i++)

cout<< arr[i]<<" ";


 getch();


}

 ----------------------------------------------------------------------------------------------------

/*

A C++ program to insert a data in an array, at a given location or at its end.

*/


#include<iostream.h>

#include<conio.h>


void main()

{ clrscr();

 

 //Declare all the variables.

 int arr[20], i, loc, n, data;


 //prompt user to enter the number of elements ";

 cout<<"Enter the size of the array ";


 //store size in 'n'.

 cin >> n;


 cout<<"Enter the array elements\n";


 for( i =0; i<n; i++)

cin >> arr[i];


 cout<<"enter the location after which the data is to be inserted \n";


 cin >> loc;


 //Shift all the elements after loc to the right of the array by one.

 for( i = loc + 1; i < n - loc; i++)

 {

arr[i+1] = arr[i];

 }

 

 cout<<"Enter data to be inserted at "<<loc;


 cin >> arr[loc];


 //Increment size by 1

 n++;

 

 cout<<"Array after insertion \n";


 for( i =0; i<n ; i++)

  cout<<arr[i]<<" ";


 getch();


}

-------------------------------------------------------------------------------------------------------------

/*

A C++ program to delete a data in an array, at a given location or at its end.

*/


#include<iostream.h>

#include<conio.h>


void main()

{ clrscr();

 

 //Declare all the variables.

 int arr[20], i, loc, n, data;


 //prompt user to enter the number of elements ";

 cout<<"Enter the size of the array ";


 //store size in 'n'.

 cin >> n;


 cout<<"Enter the array elements\n";


 for( i =0; i<n; i++)

cin >> arr[i];


 cout<<"enter the location after which the data is to be inserted \n";


 cin >> loc;


 

 //Shift all the elements after loc to the right of the array by one.

 for( i = loc + 1; i < n - loc; i++)

 {

arr[i+1] = arr[i];

 }

 

 cout<<"Enter data to be inserted at "<<loc;


 cin >> arr[loc];


 if( loc != 0)

 {

//Shift all the elements after the location to the left by 1.

for (i = loc+1; i < n; i--)

{

arr[i] = arr[i + 1];

}


 }


 //Decrement size by 1

 n--;

 

 cout<<"Array after insertion \n";


 for( i =0; i<n ; i++)

  cout<<arr[i]<<" ";


 getch();


}

----------------------------------------------------------------------------------------------------------------

/*

A C++ program to swap two numbers using call by value

and call by reference. Practical 11.

*/


#include<iostream.h>

#include<conio.h>


//Function prototype declaration for call by reference.

void swapReference(int *, int *);


void main()

{

clrscr();


//Declare all variables.

int a, b, temp, choice;


//Menu.

cout<<"Enter '1' for swapping using call by value \n";


cout<<"Enter '2' for swapping using call by reference \n";


cout<<"Enter '0' to exit \n";


//Menu options using switch statement.


switch(choice):

{

case 1:

cout<<"Enter any two numbers : \n";


cin >> a >> b;


cout<<"Before swap a = "<<a<<" b = "<<b;


temp = a;


a = b;


b = temp;


cout<<"\nAfter swap a = "<<a<<" b = "<<b;


break;


case 2:

cout<<"Enter any two numbers : \n";


cin >> a >> b;


cout<<"Before swap a = "<<a<<" b = "<<b;


swapReference(&a, &b);


cout<<"\nAfter swap a = "<<a<<" b = "<<b;


break;


case 0:


cout<<"Thank you\n";


break;


default:


cout<<"Invalid input! try again. \n";


}

getch();

}


//Function definition.

void swapReference(int * a, int *b)

{

int temp;


temp = *a;


*a = *b;


*b = temp;

}

--------------------------------------------------------------------------------------------------------

/*

A C++ program to print all the Pythagorean triplets between 1 and user given limit using

Turbo C++ compiler.

*/


#include<iostream.h>

#include<conio.h>

void main()

{

    //Declare int variables.

    int a, b, c, sum = 0, limit;


    //Prompt user to input upper limit.

    cin>>limit;

    for(a = 1; a<limit; a++)

    {

        for(b = 1; b<limit; b++)

        {

            for(c = 1; c<limit; c++)

            {

                if( a*a == (b*b + c*c) && (a+b+c) != sum)

                {

                    //To filter duplicate triplets.

                    sum = a+b+c;


                    //Print the triplets.

                    cout<<a<<" "<<b<<" "<<c<<endl;

                }

            }

        }

    }

        getch();

}


--------------------------------------------------------------------------------------------------

 /*

A C++ program to count the number of characters and words in a sentence entered by user.

*/


#include<iostream.h>

#include<conio.h>


void main()

{

clrscr();


int chars=0, words = 1;


char c;


while((c=getche()) != '\r')

{

if(c == ' ')

words++;

else

chars++;

}


cout<<"Number of characters "<<chars;

cout<<"\nNumber of words "<<words;


getch();


}


----------------------------------------------------------------------------------------------------------------------

/*


A C++ program to return cube of a number using inline function.


*/


#include<iostream.h>

#include<conio.h>


//Declare the inline function.


inline int cube(int a)

{

return a*a*a;

}


void main()

{


clrscr();


//Declare all variables.

int number, cube;


//Prompt user to enter a number.

cout<<"Enter a number ";


//Store user input in the integer variable 'number'.

cin>>number;


//Pass number as argument to the inline function 'cube()'.

cube = cube(number);


cout<<"The cube of the number is :"<<cube;


getch();


}


-------------------------------------------------------------------------------------------------------------------


/*

A C++ program to convert all upper case letters of a word to

lower case and vice-versa.

*/


#include<iostream.h>

#include<conio.h>

#include<ctype.h>


void main()

{

clrscr();


//Declare all variables.

int i=0, j=0;

char word[50];


//prompt user to enter a word.

cout<<"Enter a word ";


cin>>word;

//Replace lower case with upper and vice-versa.

while(word[i] != '\0')

if( isupper(word[i]))

{

word[i] = tolower(word[i]);

i++;

}

else

{

word[i] = toupper(word[i]);

i++;

}

}


//Print the new word with case reversed.

while( word[j] != '\0')

{


cout<<word[j];

j++;

}


getch();

}


--------------------------------------------------------------------------------------------------------------------

/*


A C++ program to get maximum of given numbers.


*/


#include<iostream.h>

#include<conio.h>


void main()

{


clrscr();


int max, i;


A[5] = {12,54,6,99,2};


max = A[0];


for(i=1; i<5; i++)

if max < A[i];


{

max = A[i];


}

}


cout<<"The maximum value is "<<max;


getch();


}

-----------------------------------------------------------------------------------------------------------------

/*

A C++ program to get minimum of given numbers.

*/

#include<iostream.h>
#include<conio.h>

void main()
{

clrscr();

int min, i;

A[5] = {12,54,6,99,2};

min = A[0];

for(i=1; i<5; i++)
if min > A[i];

{
min = A[i];

}
}

cout<<"The minimum value is "<<min;

getch();

}

-------------------------------------------------------------------------------------------------------------------

/*

A C++ program to reverse a number using pointers. Practical 22.

*/

#include<iostream.h>
#include<conio.h>


void main()
{

clrscr();

//Declare all variables.
int digit;

long int num;

//Declare a pointer variable 'p' that points to num.
long int * p = &num;

//Prompt user to enter a number.
cout<<"Enter a number : ";

//Store user input in num.
cin >> num;

//Separate the digits of num from end and print them on screen.
while(num % 10)
{
digit = (* p) % 10;

//Print the last digit first.
cout<<digit;

//Drop the last digit of num.

* p = (* p)/10;

}
getch();

}

------------------------------------------------------------------------------------------------------------------

/*
A C++ program to accept an integer array of size 10 . Display the 
squares of all the elements by using pointer to array. Practical 23.
*/

#include<iostream.h>
#include<conio.h>

void main()
{

clrscr();

//Declare variables.

int arr[10], i = 0;

//Prompt user to enter 10 integers.
cout<<"Enter 10 integers : ";

//Store all the integers in the array.
for( i = 0; i<10; i++)
{
cin >> arr[i];
}

//Display the squares of all elements using pointer to array.
for( i = 0; i<10; i++)
{
cout<<(*(arr + i))*(*(arr + i))<<" ";
}

getch();

}

--------------------------------------------------------------------------------------------------------------------

/*
A C++ program to accept a 4x4 matrix and find the sum of
the odd numbers of the matrix. Practical 17.
*/

#include<iostream.h>
#include<conio.h>

void main()
{
clrscr();
//Declare variables.
int matrix[4][4], i =0 , j =0, sum = 0;

//Prompt user to enter a 4x4 matrix.
cout<<"Enter a 4x4 matix : \n";

//Store the user input in the 2-D array 'matrix'.
for( i = 0; i<4; i++)
{
for(j =0; j<4 ; j++)
{
cin >> matrix[i][j];

}
}

//Sum all the odd numbers of the matrix.
for( i = 0; i<4; i++)
{
for(j =0; j<4 ; j++)
{
if( matrix[i][j] % 2 != 0)
{
sum = sum + matrix[i][j];
}

}
}

//Display the sum.
cout<<"Sum of odd numbers of matrix : "<<sum;

getch();
}

----------------------------------------------------------------------------------------------------------------

//A C++ program to create a class with given members. Practical 19.

#include<iostream.h>
#include<conio.h>
#include<string.h>

//Define the class.
class Competition
{

private:
int learner_id;
string learner_name;

char category[6];

string competition_name;

int position;

int points;

public:
//Define a function that returns points.
int points( int position)
{

switch(position)
{

case 1:
points = 10;

break;

case 2:

points = 7;

break;

case 3:

points = 5;

break;
default:
points = 0;

}
return points;

}


}; //End of class definition.


void main()
{
clrscr();


//Create objects of the class.
Competition comp;

//Access class member functions using dot operator.
comp.points(7);

getch();

}

-----------------------------------------------------------------------------------------------------------------------

// Derived class , practical 20.

#include<iostream.h>
#include<conio.h>
#include<string.h>

//Define the class COURSE.
class COURSE
{
//Declare all the private data members of the class.
private:
int course_id;

string course_name;

int duration;

float fee;
//Declare and define all the public member functions of the class.

public:
void accept(int course_id, string course_name, int duration, float fee)
{
this.course_id = course_id;

this.course_name = course_name;

this.duration = duration;

this.fee = fee;
}

};

//Define the publically inherited derived class SR_SECONDARY.
class SR_SECONDARY : public COURSE
{
//Declare private data members of the class.
private:
string subject1;

string subject2;

string subject3;

//Declare and define all the public member functions of the class.
public:
void enter(string subject1, string subject2, string subject3)
{
this.subject1 = subject1;

this.subject2 = subject2;

this.subject3 = subject3;
}

void display()
{
cout<<"Subject1 : "<<subject1<<'\n';

cout<<"Subject2 : "<<subject2<<'\n';

cout<<"Subject3 : "<<subject3<<'\n';
}

};

//Define the protectedly derived class VOCATIONAL from the class SR_SECONDARY.

class VOCATIONAL : protected SR_SECONDARY
{
//Declare all private data members of the class.
private:
string voc_name;

string requirement;

int age;

//Declare and define all public member functions of the class.
public:
void voc_accept(string voc_name, string requirement, int age)
{
this.voc_name = voc_name;

this.requirement = requirement;

this.age = age;
}

void voc_display()
{
cout<<"Vocationa Name : "<<voc_name<<'\n';

cout<<"Requirement : "<<requirement<<'\n';

cout<<"Age : "<<age;
}
};



void main()
{

clrscr();

//Create objects of all the classes and invoke respective member functions.
COURSE cr;

cr.accept(1, "BCA", 3, 12000.00);

SR_SECONDARY sr;

sr.enter("Maths", "Data Structues", "Algorithms");

sr.display();

VOCATIONAL vc;

vc.voc_accept("Music", "High School", 16);

vc.voc_display();

getch();

}

----------------------------------------------------------------------------------------------------------------

/*

A C++ program to find the area of a triangle, given its three sides by the user.

*/

#include<conio.h>
#include<iostream.h>
#include<math.h>


void main()
{

clrscr();

//declare all variables.
float a, b, c, s, A;

//Prompt user to input three sides of the triangle.
cout<<"Enter the three sides of the triangle :";

//store user input.
cin>>a>>b>>c;

//Calculate the semi-perimeter.
s = (a+b+c)/2;

//Calculate the area of the triangle using Heron's formula.
A = sqrt( s*(s-a)*(s-b)*(s-c))

//Print area on the screen.
cout<<"\nArea of the triangles is :"<<A;

getch();
}

------------------------------------------------------------------------------------------------------------

/*

A C++ program to check if a number given by user is an Armstrong number.

*/


#include <math.h>
#include<conio.h>
#include<iostream.h>

void main() {
   
    //Declare variables.
   int num, originalNum, remainder, n = 0;

   float result = 0.0;

   printf("Enter an integer: ");

   //Store number entered by user in integer variable 'num'.
   scanf("%d", &num);

   //Store value of 'num' into variable 'originalNum'
   originalNum = num;

   // store the number of digits in num in variable 'n'.

   for (originalNum = num; originalNum != 0; ++n) 
  {
       originalNum /= 10;
   }


   //Extract the digits of 'num', and raise to power 'n' and get their sum.

   for (originalNum = num; originalNum != 0; originalNum /= 10) 
{
       remainder = originalNum % 10;

      // store the sum of the power of individual digits in result
      result += pow(remainder, n);
   }


   // if num is equal to result, the number is an Armstrong number
   if ((int)result == num)
   {
    printf("%d is an Armstrong number.", num);
    }
   else
    {
    printf("%d is not an Armstrong number.", num);
     }


}

-----------------------------------------------------------------------------------------------------------------------------

/*

A C++ program to write the factorial of a number.

*/

#include<iostream.h>
#include<conio.h>

void main()
{
clrscr();

//Declare all the variables.

int n, f=1, i=1;

//prompt user to enter a positive number.
cout<<"Enter a positive number :";

//store user input into 'n'.
cin>>n;

//Compute the factorial and store its value in 'f'.
while(i <= n)
{

f = f*i;

i++;

}
//Print the factorial on screen.
cout<<"Factorial of "<<n<<" = "<<f <<endl;

 getch();
}

-----------------------------------------------------------------------------------------------------------

/*

A C++ program to print the Fibonnaci series upto the nth term.

*/

#include <iostream.h>
#include<conio.h>

void main() 
{
    //clear screen.
     clrscr();

    //Declare all the variables.
     int n, t1 = 0, t2 = 1, nextTerm = 0;

     //Prompt user to enter the number of terms to be printed. 
    cout << "Enter the number of terms: ";

     //Store the term in variable 'n'.
    cin >> n;

     //Print "Fibonnaci Series" on the screen.
    cout << "Fibonacci Series: ";

    //For loop to print the series.
    for (int i = 1; i <= n; ++i) 
      {
        
       // Prints the first two terms.
        if(i == 1) 
        {
            cout << t1 << ", ";
            continue;
        }
        if(i == 2) 
       {
            cout << t2 << ", ";
            continue;
        }

        //Sum of the last two terms becomes the next term.
        nextTerm = t1 + t2;
        
        //The previous term becomes the first term for the next term.
        t1 = t2;

        //The new term becomes the second term for the next term.
        t2 = nextTerm;
        
        //Print the terms of the series on the screen.
        cout << nextTerm << ", ";
    }

    getch();
}

--------------------------------------------------------------------------------------------------------------

/*

A C++ program to find the GCD/HCF of two positive numbers.

*/

#include<iostream.h>
#include<math.h>
#include<conio.h>

int main()
{
    //clrscr();

    //Declare all variables.
    int a, b, result;

    //Prompt user to input two positive numbers.
    cout<<"Enter any two positive numbers :";

    //Store user inputs
    cin>>a>>b;

    //Find Minimum of a and b
    result = min(a, b);


    while (result > 0)
    {
        if (a % result == 0 && b % result == 0)
        {
            break;
        }

        result--;
    }

    // Return gcd of a and b
    cout<<"GCD of "<<a<<" and "<<b<<" is "<<result;

    //getch();

}

-------------------------------------------------------------------------------------

/*

A C++ program to check if the given number is a prime number.

*/

#include <iostream.h>
#include<conio.h>

void main() {


   //Clear screen.
    clrscr();

  //Declare all the variables.
  int i, n;
  bool is_prime = true;

  //Prompt user to enter a positive integer.
  cout << "Enter a positive integer: ";

  //Put user input into variable 'n'.
  cin >> n;

  // 0 and 1 are not prime numbers
  if (n == 0 || n == 1) 
  {
    is_prime = false;
  }

  // loop to check if n is prime
  for (i = 2; i <= n/2; ++i) 
{
    if (n % i == 0) 
    {
      is_prime = false;

      break;
    }

  }

  if (is_prime)
    {
    cout << n << " is a prime number";
    }
  else
   {
    cout << n << " is not a prime number";
     }

    getch();
}

--------------------------------------------------------------------------------------------------------

/*

A C++ program to print the table of 'n'.

*/

#include <iostream.h>
#include<conio.h>

void main()
{

//Clear the screen.
clrscr();

//Declare all the variables.
int i, n;

//prompt user to input a number.
cout<<"Please enter a integer number "<<endl;

              //Store user input into 'n'.
cin>>n;

              //Print the table.

  for(i = 1; i<= 10; i++)
{

cout<<"n x "<<i<<" = "<<n*i<<endl;
}

getch();
 
}

------------------------------------------------------------------------------------------------

/*

A C++ program to print all the Pythagorean triplets between 1 and user given limit.

*/

#include<iostream.h>
#include<conio.h>

void main()
{
    //Declare int variables.
    int a, b, c, sum = 0, limit;

    //Prompt user to input upper limit.
    cin>>limit;

    for(a = 1; a<limit; a++)
    {
        for(b = 1; b<limit; b++)
        {
            for(c = 1; c<limit; c++)
            {
                if( a*a == (b*b + c*c) && (a+b+c) != sum)
                {
                    //To filter duplicate triplets.
                    sum = a+b+c;

                    //Print the triplets.
                    cout<<a<<" "<<b<<" "<<c<<endl;

                }
            }
        }
    }

        getch();
}

--------------------------------------------------------------------------------------------------


Wednesday, January 17, 2024

Pandas, Numpy and Matplotlib: Basic Python libraries for Loading data from data files into our Python program.

Install all these three libaraies using the following commands:

pip install pandas 

pip install numpy

pip install matplotlib --user

Now, open the Python interpreter and import each in your Python program as follows:

import pandas as pd

import numpy as np

import matplotlib.pyplot as plt

Now start using each of them in your program as follows:

df = pd.read_csv('location path of the .csv file from which data has to be loaded')



How can I run a C++ program directly from Windows?

How-can-I-run-a-C-program-directly-from-Windows