Monday, 11 October 2021
Saturday, 9 October 2021
Introduction to Python
Author October 09, 2021 Python No comments
Wednesday, 6 October 2021
Control structures [if elif]
Author October 06, 2021 Projects, Python No comments
- Whenever you want to execute certain commands only when the certain condition is satisfied.
- So, in that case you can go for if else statements, the condition can also be single or you can also give multiple condition, in that case you will have multiple else statements.
- In the image below you can see this, more clearly.
- So, first we will look into the if else family of constructs, if else and If-elif-else are a family of constructs, where a condition is first checked, if it is satisfied only then the operations will be performed.
- If, the condition is not satisfied the code exits the construct or moves on to the other options. So, whenever we use just an if statement or with an else statement or with using multiple if's and multiple else clause.
- The first check would be the condition, whenever the condition is satisfied only then the code will be executed or the statement will be executed, otherwise the code exits the construct itself and moves to the other options. So, that is how the if else family of the constructs works.
- Let us see different task for each construct. So, first we will look into if construct, the command would be if expression colon and statements in the next line.
- If is a key word, if the condition is satisfied whatever condition you have given it under the expression, then the statements will get executed. Otherwise, the code exit the construct itself.
- Next, we will move ahead and see what is the syntax would be for If-else construct
- It forms a basis from the if construct, wherever we have given the first statement, using the if keyword and followed by if keyword you have to give the expression to be checked, that is where the condition to be specified.
Tuesday, 5 October 2021
Introduction to Python for Data Science
Author October 05, 2021 Python No comments
- Data Science is the art of analyzing using statistics and machine learning techniques raw data with a perspective of drawing valuable insight from it.
- Data Science is used in many industries to allow them to make better business and decisions, and in the sciences to test models or theories.
- This requires process of inspecting, cleaning, modelling, analyzing and interpreting raw data.
- Python libraries provide basic key features sets which are essential for data science.
- Data Manipulation and Pre-Processing
Operations On Dataframe in Python [Part II]
Author October 05, 2021 Projects, Python No comments
- So, next we are going to see about how to get the concise summary of DataFrame.
- So, there is a command called info that returns a concise summary of a DataFrame, the concise summary includes the data type of index; index being the row labels, the data type of row labels is what the output gives as well as it gives the data type of columns, it also gives the count of non-null values.
- Basically, how many filled values are there in your DataFrame.
- Also, it gives the memory usage of the DataFrame and the syntax would be you use the info command along with the DataFrame name.
Operations On Dataframe in Python
Author October 05, 2021 Pandas, Python No comments
- If you want to check the data type of each column, because whenever you have been given a data, you want to really check what is the structure of the data; that means, which variable has which data type?
- In, that case you can use dtypes, because that returns a series with the data type of each column and the syntax would be you use dtypes along with the Data Frame name.
- So, Data Frame.dtypes will give you a series with the data type of each column
- So, now we have an overall idea about what are the data types that we are going to work with using the cars_data.
- There is also an option where you can get the count of unique data types available in your Data Frame.
- So, in that case get_dtype_counts, returns the counts of unique data types in the data frame.
- So, now we also have an overall idea about the count of unique data types that we are going to handle with.
- So, now, we know about how to get the data type of each variables. So, there might be cases where you want to perform the operations only on a numerical data type.
- Similarly, there can be cases where you are going to work with only categorical data type.
Wifi Password Generator in Python
Author October 05, 2021 Projects, Python No comments
WIFI PASSWORD EJECTOR
Description
- a simple python script that tells you the password of the wifi you're connected with
Requirements
- just need to install python in your system.
Monday, 4 October 2021
Python Project [ Age_Calculator]
Author October 04, 2021 Projects, Python No comments
Calculate Your Age!
This script prints your age in three different ways :
- Years
- Months
- Days
Prerequisites
You only need Python to run this script. You can visit here to download Python.
Python Project [Whatsapp Bot]
Author October 04, 2021 Projects, Python No comments
Whatsapp Bot
Perform Operation like
- Put your details
- connect with internet
- Pass your message
Python Project [ Digital Clock]
Author October 04, 2021 Projects, Python No comments
import tkinter as tk | |
from time import strftime | |
def light_theme(): | |
frame = tk.Frame(root, bg="white") | |
frame.place(relx=0.1, rely=0.1, relwidth=0.8, relheight=0.8) | |
lbl_1 = tk.Label(frame, font=('calibri', 40, 'bold'), | |
background='White', foreground='black') | |
lbl_1.pack(anchor="s") | |
def time(): | |
string = strftime('%I:%M:%S %p') | |
lbl_1.config(text=string) | |
lbl_1.after(1000, time) | |
time() | |
def dark_theme(): | |
frame = tk.Frame(root, bg="#22478a") | |
frame.place(relx=0.1, rely=0.1, relwidth=0.8, relheight=0.8) | |
lbl_2 = tk.Label(frame, font=('calibri', 40, 'bold'), | |
background='#22478a', foreground='black') | |
lbl_2.pack(anchor="s") | |
def time(): | |
string = strftime('%I:%M:%S %p') | |
lbl_2.config(text=string) | |
lbl_2.after(1000, time) | |
time() | |
root = tk.Tk() | |
root.title("Digital-Clock") | |
canvas = tk.Canvas(root, height=140, width=400) | |
canvas.pack() | |
frame = tk.Frame(root, bg='#22478a') | |
frame.place(relx=0.1, rely=0.1, relwidth=0.8, relheight=0.8) | |
lbl = tk.Label(frame, font=('calibri', 40, 'bold'), | |
background='#22478a', foreground='black') | |
lbl.pack(anchor="s") | |
def time(): | |
string = strftime('%I:%M:%S %p') | |
lbl.config(text=string) | |
lbl.after(1000, time) | |
time() | |
menubar = tk.Menu(root) | |
theme_menu = tk.Menu(menubar, tearoff=0) | |
theme_menu.add_command(label="Light", command=light_theme) | |
theme_menu.add_command(label="Dark", command=dark_theme) | |
menubar.add_cascade(label="Theme", menu=theme_menu) | |
root.config(menu=menubar) | |
root.mainloop() |
Popular Posts
-
Exploring Python Web Scraping with Coursera’s Guided Project In today’s digital era, data has become a crucial asset. From market trends t...
-
What does the following Python code do? arr = [10, 20, 30, 40, 50] result = arr[1:4] print(result) [10, 20, 30] [20, 30, 40] [20, 30, 40, ...
-
Explanation: Tuple t Creation : t is a tuple with three elements: 1 → an integer [2, 3] → a mutable list 4 → another integer So, t looks ...
-
What will the following code output? a = [1, 2, 3] b = a[:] a[1] = 5 print(a, b) [1, 5, 3] [1, 5, 3] [1, 2, 3] [1, 2, 3] [1, 5, 3] [1, 2, ...
-
What will the following Python code output? What will the following Python code output? arr = [1, 3, 5, 7, 9] res = arr[::-1][::2] print(re...
-
Through a recent series of breakthroughs, deep learning has boosted the entire field of machine learning. Now, even programmers who know c...
-
What will the following code output? import pandas as pd data = {'Name': ['Alice', 'Bob'], 'Age': [25, 3...
-
What will the output of the following code be? def puzzle(): a, b, *c, d = (10, 20, 30, 40, 50) return a, b, c, d print(puzzle()) ...
-
Step-by-Step Explanation: Dictionary Creation: my_dict = {'a': 1, 'b': 2, 'c': 3} A dictionary named my_dict is crea...
-
Code Explanation: Define a Recursive Function: def recursive_sum(n): A function named recursive_sum is defined. This function takes a sing...