Posts

Showing posts with the label python

Python Program to Make a Simple Password Saver

Image
In this example program, we are building a python program to safely store and retrieve the password. It stores passwords in a file. Passwords are totally secured. This program also contains a master password to use the application. Option available in the program is you can get previously-stored password. You can also add your new password. You can also check for all stored usernames. So let's start writing Python Program to build a Simple Password Saver. Note:  This program is not a fully secure program to store your important passwords. This is just an idea to create one, you can make some modifications and suggestions to us via comments.  Algorithm Upon Entry validity of user is checked by a master password, which is currently hardcoded as (rahulkumar). If validated then we enter into an endless while loop which will show you menu to do various things. If validation failed error message will be shown and program exits. we will be store all passwords as key and value pairs....

Top 5 Programming language need to learn in 2020

Image
Top 5 Programming Languages need to learn in 2020 If you're new to software development. The first question that comes to mind is where to start? This is probably true! There are hundreds of choices. How are you going to discover that this is the language I want to learn? What will be the most appropriate for you, your interests and your professional goals? One of the easiest ways to choose the best programming language to learn in 2020 is to listen to what the market says. Where the technology trend is heading ... What to learn in 2020 1. JavaScript Without Javascript, you cannot think of interactive web pages. That is the main reason JavaScript is so much popular among software developers. Today, it seems impossible to be a software developer without the use of JavaScript. First from the list is JavaScript, it seems impossible to imagine software development without JavaScript. In Stack Overflow 2018 for developers, JavaScript is the most widely used by developers in t...

Tax calculating program in Python

Image
This program is used to calculate tax in the Python programming language. Tax calculating Program in Python This Tax calculating algorithm is very in this program we can improve this algorithm a lot. Note:  this is a very basic implementation of tax calculation. One should not use this to calculate the real tax to submit in real life, this is just a simulator for practice purposes. Algorithm:  First, we are asking for user input to get the total income and total saving, then we are checking for total taxable income by reducing savings from total_income. Then we are checking for various checks for tax bands. Implementation:  Code #code #Tax calculating program in python #By Rahul Rajput total_income=int(input("Please enter you total income: ")) print("700000") total_saving=int(input("Please enter you total saving: ")) print("50000") tax_exemption_limit=500000 tax_10_percent=750000 tax_20_percent=1000000 tax_30_percent=1250000 total_taxable_income...

Bubble sort in Python Language

Image
Bubble sort is the simplest Sorting algorithm available. It works by repeatedly swapping the adjacent or neighbor element if they are in the wrong order. Working Actually in the first-pass bubble sort sets the largest element to its position, in the second pass algorithm sets the second largest element this continues till the list or array is not finally sorted. Here is the example image. To work with the algorithm you first have to understand what is swapping and how it is done. What is Swapping ?? Swapping is a technique to interchange the content of the two variables, using another variable called a temporary variable. In python programming language swapping works in two ways, both of them are shown below. For the program in Python arr = [64, 34, 25, 12, 22, 11, 90] n = len(arr) for i in range(n): # Last i elements are already in place for j in range(0, n-i-1): # traverse the array from 0 to n-i-1 # Swap if the element found is greater # than the next element if ...

Python program for Fibonacci series using Recursion

Image
What is the Fibonacci series The Fibonacci Sequence is the series of numbers: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, ... The next number is found by adding up the two numbers before it. The 2 is found by adding the two numbers before it (1+1) The 3 is found by adding the two numbers before it (1+2), And the 5 is (2+3), and so on! Example: the next number in the sequence above is 21+34 =  55 code for Fibonacci series is terms = int(input("how many terms? : ")) #taking the input from the user #using recursion to print the series def recur_fibo(n,a1,a2): if n <= 1: #return this if terms is less than 1 print(a1) return else: print(str(a1) , end=" , ") return(recur_fibo(n-1,a2,a1 + a2)) #checking for the negative number and single terms if terms <= 0: print("Please enter a positive integer") elif terms == 1: print("Fibonacci Sequence of 1 terms : ") print(0) else: recur_fibo(terms,0,1) to veri...

Distributed Systems AKTU (UPTU) lab program

Image
Distributed system DS is the subject mandatory subject in the seventh semester of the final year of Computer Science in Dr. APJ Abdul Kalam Technical University. Lab practical Questions. Assignment 1 Assignment 2 Assignment 3 Assignment 4 For the completed Answer of these assignments are in the link given below. Answers Thanks for being here. Subscribe to this blog for more post like this.

Blackjack Console game program in Python

Image
Console Games Games that can be played using the console. Here is the program for the Blackjack Game of the cards. BlackJack Game Blackjack  is the American variant of a globally popular  banking game  known as  Twenty-One. in this game, one player has to make the total sum of their hands to lower than 21 to win while another player has the total sum is 21 or more, All the cards greater than 10 are considered as the 10 and Ace is considered as the 11 or 1 depending on conditions. The person who has less total of the cards is the winner (one player should have scored more than 21). import random class blackJack: player1Hand = 0 player2Hand = 0 deck ={'Ace of Spades':1, '2 of Spades':2, '3 of Spades':3, '4 of Spades':4, '5 of Spades':5, '6 of Spades':6, '7 of Spades':7, '8 of Spades':8, '9 of Spades':9, '10 of Spades':10, 'Jack of Spades':10, 'Queen of Spades':10, 'King of ...

XML parsing in Python3 (working with ElementTree)

Image
XML Parsing in Python3 XML : XML stands for the eXtensible Markup Language. It was designed for data transport and data storage. It was designed for both Human and machine readable. That's enough for the introduction. Let's start working. First of all the XML file that we are working on. <messages>   <note id="501">     <to>Tove</to>     <from>Jani</from>     <heading>Reminder</heading>     <body>This is code in cafe</body>   </note>   <note id="502">     <to>Jani</to>     <from>Tove</from>     <heading>Re: Reminder</heading>     <body>I will not</body>   </note> </messages> We are using this file as an example XML file, name this file as the "example.xml". Let's start working with the python3. to Parse the XML by the python first, we have to import a modul...

TCP Socket Programming in Python (server/client)

Image
Socket Programming in Python What is Socket :  A  socket  is one end of a two-way communication link between two programs/software running on the network. A socket is bound to a port (also known as process id) number so that the TCP/UDP layer can identify the application that data to be transferred to. What to do? in order to create a server first, we need to create a socket in the program and put this socket into the listen mode. to that in the python is very easy, as you all know python is a very easy and powerful language. Socket Creation Create a New python file named as the server.py keep in mind that to work with socket we need to import socket into the file. import socket TCP_IP = '127.0.0.1' TCP_PORT = 15710 s = socket.socket(socket.AF_INET,socket.SOCK_STREAM) s.bind((TCP_IP,TCP_PORT)) TCP_IP is the IP of this machine you are working on, and TCP_PORT is the port to be connected. socket.AF_INET is the protocol to work with the TCP protocol. Listening to connection...

Learn Making Software (GUI) with Python3 Part-1 Installing Python3

Image
Welcome to Python3 Tutorials  Python is Very Simple and powerful Language Designed and developed By  Guido Van Rossum. Lets straight ahead to our goal installing the python package. our tutorials are based on the python3 language (a new version of python) Installing Python3 For Linux In most of the distribution of Linux python3 and python2 are already installed like Kali Linux and Ubuntu so we are skipping this portion if you have any problem you can comment in the comment section below. For Windows/Mac In order to install python3 in our mac and windows machine we have to download appropriate package from the Python language's official website, you can find it here  Python3 Download . After downloading the Package double click on it for installing it in our machine.  Then a pop up comes like that Image there. Just do recommend for the usual installation of the package. "You can do some customization if you have knowledge" , but for the beginner level just rely on the...