How To Create Python Program for wikipedia.





  • This article talks about the Internet (Internet) encyclopedia. 
  • For that Wikipedia's main page, see Wikipedia's main page. 
  • For visitor introduction to Wikipedia, see page about Wikipedia.
  • Wikipedia is a free, web-based and collaborative multilingual encyclopedia.
  • which originated in a project supported by the non-profit Wikimedia Foundation.

Installation

sudo apt-get install pip

  • Pip is a package manager for Python i.e. 
  • pip command can be used to download any external module in Python. 
  • It is something that helps us to get code written by someone else from somewhere.

Installation

pip install wikipedia

Or

sudo pip install wikipedia

  • We must first install the Python Wikipedia library, which wraps the official Wikipedia API. 
  • This can be done by entering the command below in your CMD (command prompt) or Terminal



   # importing the module........... 
import wikipedia 

   # getting suggestions.............
result = wikipedia.search("programming", results = 5) 

   # printing the result............... 
print(result) 
 

OUTPUT

['Program', 'Computer programming', 'Programming language', 'Functional programming', 'Linear programming']



How to Create Python Program to Swap Two Variables.




  • Two variables s and m, write a Python program to swap their values. 
  • Let’s see and parform different methods in Python to do this task. 


   m = input('Enter value of m : ')  
   s = input('Enter value of s : ')  

   temp = m  
   m = s  
   s = temp  
  
   print('The value of m after swapping :: {}'.format(m))  
   print('The value of s after swapping :: {}'.format(s))

OUTPUT

   Enter value of m : MOM
   Enter value of s : DAD
   The value of m after swapping :: DAD
   The value of s after swapping :: MOM
  • In this program, we use the temp variable to hold the value of m temporarily. 
  • We then put the value of s in m and later temp in s. In this way, the values get exchanged.


How To Create a Random Password Generator using Python.




Random Password Generator using Python

  • Our password is very important for you and us. 
  • Choosing passwords for accounts can sometimes be boring. 
  • So, let's solve this problem in a pythonic way and know how it happens. 
  • Let's create our own password generator using Python and avoid hackers yourself.

First Our Goal

  • We need a correctly secured password. 
  • So, our password contains digit, symbol lowercase and uppercase alphabet. 
  • So, first we ask users how long is your password because we are safe or not.

Project Requirement

To build this project we will use the basic concept of python and libraries –  random, string.

Installation

  • We are used these two models, random and string
  • In case not installed then copy this following command and paste in your terminal/CMD (Command Prompt) to install.
  • These are two way using sudo command and without using sudo.

pip install string

sudo pip install string

pip install ramdom

sudo pip install random

The First step is to import libraries

import string 
import random


Password.py

import string
import random
if __name__ == "__main__":
    m1 = string.ascii_lowercase
    m2 = string.ascii_uppercase
    m3 = string.digits
    m4 = string.punctuation
    plentxt = int(input("Enter Your Password Length: "))
    m = []
    m.extend(list(m1))
    m.extend(list(m2))
    m.extend(list(m3))
    m.extend(list(m4))
    print("Your password is: ", end="")
    print("".join(random.sample(m, plentxt)))

OUTPUT

  Enter Your Password Length: 8
  Your password is: |&`_afI