Showing posts with label python programming. Show all posts
Showing posts with label python programming. Show all posts

Monday, October 18, 2021

Getting Started with Python Programming as an absolute beginner with Thonny IDE

 Hello Everyone ✊,

Getting started with python programming or python scripting might be complicated if you head in the wrong direction. As an absolute beginner with no prior experience in any programming language or just a little experience with HTML scripting, python programming seems a lot.

If you google getting started with python as an absolute beginner, you will get hundreds of thousands of results. That's complex. You need a good user-friendly IDE (Integrated Development Environment) and have python installed on your pc

All you need to do is download an IDE name (Thonny). It is the simplest IDE available for python programming as an absolute beginner. It offers a lot of features that are very useful and will improve your programming skills.

Go ahead and download it by click on (Thonny). after you have downloaded thonny, you need to install it by clicking setup. When you install thonny python programming language automatically installs with it, you don't need to install it separately.

Thonny offers various features like syntax highlighting for code and comments, tabbed programming for parallel coding, and much more. If you are working on a python programming project and you need to install any package, thonny also offers package installation very quickly. You don't need to visit any website to install any python package. all you need to do is just go to Tools >> Manage Package >> then the following window will appear

How_To_Install_Python_Packages_In_Thonny














On the right side, you will see the name of packages that can be installed right away; if you want to search any python package that is not listed, you can type in the search bar and hit search on PyPI. after you have searched all you need to do is to hit install. You just install a python package without using any complex pip command


One more important feature of thonny is debugging, which we will discuss in upcoming sections.


If you find this helpful, rate us and like us.

Monday, April 26, 2021

Create Your Own Random Password Generator Using Python [Free Source Code]

This program generates random password using simple python script. This script can be a good small python project to be shown in your class or to your colleagues.

 

To begin programming our random password generator, first, we need to import 'random module' from python 3. This is built in module and you don't need to install any package for that. Simply write

 

import random

 

Next we define list to store password, which will be generated by script.

 

password = []

 

Next step is to define lists of characters, numbers and symbols for password. Keep in mind that these are user generated lists you can customize them according to your preference.

 

letters = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','a','b','c''d''e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']

 

numbers = ['1','2','3','4','5','6','7','8','9','0']

 

characters = ['+','(',')','*','%','^','$','_','@','=']

 

 

Now that we have laid basic bricks for our code, we must know the length of password that user want’s to generate and number of characters or symbols or numbers user wants to add to its password. To do this we define three input statements which ask user for its preference regarding password.  Simply write

no_letters = int(input("How many letters would you like in your password?\n"))

no_numbers = int(input("How many number would you like?\n"))

no_characters = int(input("How many symbols would you like?\n"))

 

above three statements take input from user and store them in variables called no_letters, no_numbers and no_characters, [You can use your own naming scheme], and store them as int type.

Next we start generating password by simply looping through our lists [letters, numbers and characters]. Go ahead and write

for x in range(0,no_letters):

    password += random.choice(letters)

 

for x in range(0,no_numbers):

    password += random.choice(numbers)

 

for x in range(0,no_characters):

    password += random.choice(characters)

 

now that password has been generated but it will contain sequential characters, just for understanding the password is not random so we will shuffle it by writing

 

random.shuffle(password)

 

and then we store it in a new password like this.

 

random.shuffle(password)

 

new_password = ""

 

for char in password:

    new_password += char

 

and in the last we just simply print it by writing

 

print(f"Your password is {new_password}")

 

putting everything together. Below is the complete code of random password generator python project. This code should run just fine on your machine.

 

 



Source Code 👇
#-------------------------------------------------------------------



#This program generates password randomly


import random

password = []

letters = ['A','B','C','D','E','F','G','H','I','J','K','L',
'M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','a',
'b','c''d''e','f','g','h','i','j','k','l','m','n','o','p',
'q','r','s','t','u','v','w','x','y','z']
numbers = ['1','2','3','4','5','6','7','8','9','0']
characters = ['+','(',')','*','%','^','$','_','@','=']


no_letters = int(input("How many letters would you like in your password?\n"))
no_numbers = int(input("How many number would you like?\n"))
no_characters = int(input("How many symbols would you like?\n"))


for x in range(0,no_letters):
    password += random.choice(letters)


for x in range(0,no_numbers):
    password += random.choice(numbers)


for x in range(0,no_characters):
    password += random.choice(characters)

random.shuffle(password)

new_password = ""

for char in password:
    new_password += char

print(f"Your password is {new_password}")

#-------------------------------------------------------------------
Output 👇
How many letters would you like in your password?
12
How many number would you like?
4
How many symbols would you like?
2
Your password is Tw5@4o1*b3ewiYQSzw



















If you faced any kind of difficulty in writing this code or executing it, feel free to write in comment section below.


Complete Video Tutorials