Creating Virtual Environment for Python
» Download Python
» Steps to create '
1. Navigate to the folder where you want to make your project
Example:
2. Open terminal (local terminal, command prompt, or vs code terminal) in that folder
3. Now, use these commands
4. Your virtual environment is created in that folder, now activate this virtual environment using this command.
Command for 'Command Prompt':
Command for 'Powershell':
Command for Git Bash or WSL:
If Powershell gives you error like
5. Congratulations🎊 Your virtual environment activated now make your project
Happy Coding 👨💻
» Download Python
First you need python installed in your local machine to create virtual environment.
Download Python from Here
» Steps to create '
.env
' folder (virtual environment for python)1. Navigate to the folder where you want to make your project
Example:
cd D:/code/
2. Open terminal (local terminal, command prompt, or vs code terminal) in that folder
3. Now, use these commands
python --version # Type this and hit enter to verify the python version
# Now use these commands
python -m venv .env
4. Your virtual environment is created in that folder, now activate this virtual environment using this command.
Command for 'Command Prompt':
.\env\Scripts\activate
Command for 'Powershell':
.\env\Scripts\Activate.ps1
Command for Git Bash or WSL:
source \.env\bin\activate
If Powershell gives you error like
File cannot be loaded because running scripts is disabled
then use this command!Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
5. Congratulations🎊 Your virtual environment activated now make your project
Happy Coding 👨💻
🐳3❤1👍1🕊1
Day 07 👾:
Q. Stock Buy and Sell - Multiple Transaction Allowed (Hard)
Given an arrayprices[]
of sizen
denoting the cost of stock on each day, the task is to find the maximum total profit if we can buy and sell the stocks any number of times.
Note: We can only sell a stock which we have bought earlier and we cannot hold multiple stocks on any day.
❤3🔥3
Day 08👾:
Given an arrayprices[]
of length n, representing the prices of the stocks on different days. The task is to find the maximum profit possible by buying and selling the stocks on different days when at most one transaction is allowed. Here one transaction means1
buy + 1 Sell
. If it is not possible to make a profit thenreturn 0
.
Note: Stock must be bought before being sold.
👍2🐳2👏1🕊1
» Image Captcha Generator 👨💻
1. At first create virtual environment for your project (This is more convenient when you building a project, it provides an isolated space from your default local machine's python interpreter.
2. Now let's install libraries that we need
3. Let't Write code for our image captcha
Run Code and test yourself
Happy Coding 👨💻
Let's make a image captcha generator using python.
You can use it in your website or in telegram bots for user verifications, it generate random text in image so that bots can be recognize..
1. At first create virtual environment for your project (This is more convenient when you building a project, it provides an isolated space from your default local machine's python interpreter.
If you don't know how to make virtual environment, Follow This Post
2. Now let's install libraries that we need
pip install captcha pillow
3. Let't Write code for our image captcha
from captcha.image import ImageCaptcha
from io import BytesIO
from PIL import Image
import string, random
def random_text():
text = string.ascii_letters + string.digits
f_text = ''
for i in range(6):
f_text += random.choice(text)
return f_text
def image_captcha(text: str) -> None:
captcha: ImageCaptcha = ImageCaptcha(width=400, height=200, font_sizes=(50, 70, 100))
data: BytesIO = captcha.generate(text)
image: Image = Image.open(data)
image.show('Temp')
if __name__ == '__main__':
image_captcha(random_text())
Run Code and test yourself
@NotCoding | @CodesSnippet
Happy Coding 👨💻
🔥2👏2❤1🐳1
° Setup and install Tailwindcss °
→ Now node is installed in your pc now we will install Tailwindcss, follow the steps
1. Go to folder where you want to make your project. (You can also install it directly by terminal.)
Example:
2. Right-click and open in terminal or open that folder in vs code and open terminal there.
3. Install Tailwindcss.
4. Initalize Tailwind for your project (run this command in that directory where you want to setup and develop your project).
5. You will see
6. Create 2 folders named
7. And in
8. Now edit that
9. Now run this code in terminal (This will work as live server for tailwindcss).
10. Now Tailwindcss installed and now u can write your html code. You don't need to edit
Happy Coding 👨💻
→ To setup and install Tailwindcss in your local machine (pc), you need to follow some steps!!
→ At first to install Tailwindcss you need nodejs installed in your pc, let's intsall nodejs first..
› To install nodejs visit official website of nodejs, download latest version and install it simply by running that executable file.
› If you have Mac or linux then go to Official website and choose nodejs for your machine.
> Verify installation by running command:node -v
→ Now node is installed in your pc now we will install Tailwindcss, follow the steps
1. Go to folder where you want to make your project. (You can also install it directly by terminal.)
Example:
cd D:/code/
2. Right-click and open in terminal or open that folder in vs code and open terminal there.
3. Install Tailwindcss.
npm install -D tailwindcss
4. Initalize Tailwind for your project (run this command in that directory where you want to setup and develop your project).
npx tailwindcss init
5. You will see
tailwind.config.js
named file is created, you need to edit it. Open that file you will see some code (keep it for now let's create some folder first).6. Create 2 folders named
dist
and src
, in src
folder create a file named input.css
and write this code in this file.@tailwind base;
@tailwind components;
@tailwind utilities;
7. And in
dist
folder your all project file will placed make their index.html
and style.css
.8. Now edit that
tailwind.config.js
mentioned in step 5. Edit Content property in this file./** @type {import('tailwindcss').Config} */
module.exports = {
content: ["./dist/*.html"],
theme: {
extend: {},
},
plugins: [],
}
9. Now run this code in terminal (This will work as live server for tailwindcss).
npx tailwindcss -i ./src/input.css -o ./dist/style.css --watch
10. Now Tailwindcss installed and now u can write your html code. You don't need to edit
style.css
just write code in html file. For more visit official website of tailwindcss and read docs.@NotCoding | @CodesSnippet
Happy Coding 👨💻
🔥2❤1⚡1👍1👏1
» Random Password Generator using Tailwind
› Here's HTML Code of it.
Happy Coding 👨💻
Random Password Generator is a web application that allows users to create secure passwords based on their preferences. It is built using HTML, TailwindCSS, and JavaScript.
NOTE: To setup Tailwindcss in your pc follow these instructions.
› Here's HTML Code of it.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Random Password</title>
<link rel="stylesheet" href="style.css">
<link rel="shortcut icon" href="icon.png" type="image/x-icon">
</head>
<body class="p-0 m-0 h-[100vh] w-full grid place-content-center justify-items-center place-items-center text-white bg-blue-400">
<div class="bg-slate-400 h-[95vh] w-[97vw] rounded-2xl flex justify-center items-center">
<div class="bg-slate-600 h-[18rem] w-[25rem] rounded-xl border-b-black p-2 text-center">
<h1 class="font-extrabold font-serif mt-1 select-none cursor-default">
Random Password Generator
</h1>
<div class="h-fit flex justify-center items-center flex-col border-black border-2 m-5 rounded-xl">
<div class="p-2 h-[4rem] border border-black w-[95%] mt-2 rounded-t-xl rounded-b-md flex justify-center items-center">
<code id="pass-gen" class="select-none"></code>
</div>
<div class="mt-1 mb-2 rounded-b-xl rounded-t-md p-2 w-[95%] h-fit border-black border cursor-pointer active:scale-95 hover:bg-gray-500 hover:border-green-300 transition duration-200 ease-in-out" id="copy-item">
<h2 class="font-semibold font-sans select-none">
Copy
</h2>
</div>
</div>
<div class="flex justify-center items-center m-2 select-none">
<div class="px-2 cursor-pointer select-none">
<input type="checkbox" name="Alphabet" id="alphabets" class="cursor-pointer">
<label for="alphabets" class="cursor-pointer select-none">Alphabets</label>
</div>
<div class="px-2 cursor-pointer select-none">
<input type="checkbox" name="Numbers" id="numbers" class="cursor-pointer">
<label for="numbers" class="cursor-pointer select-none">Numbers</label>
</div>
<div class="px-2 cursor-pointer select-none">
<input type="checkbox" name="Symbols" id="symbols" class="cursor-pointer">
<label for="symbols" class="cursor-pointer select-none">Symbols</label>
</div>
</div>
<div class="flex justify-center items-center">
<div class="h-fit w-[90%] p-2 font-bold rounded-3xl bg-green-600 cursor-pointer text-black select-none active:scale-95 hover:bg-green-500 transition duration-200 ease-in-out" id="generate-button">
Generate
</div>
</div>
</div>
</div>
<script src="script.js"></script>
</body>
</html>
• For Full Code Here
• Demo Website is Here
@NotCoding | @CodesSnippet
Happy Coding 👨💻
👍2🔥2🫡2👏1
Day 14👾:
Given a strings
, the objective is to convert it into integer format without utilizing any built-in functions. Refer the below steps to know aboutatoi()
function.
Cases foratoi()
conversion:
1. Skip any leading whitespaces.
2. Check for a sign(‘+’ or ‘-‘)
, default to positive if no sign is present.
3. Read the integer by ignoring leadingzeros
until a non-digit character is encountered or end of the string is reached. If no digits are present,return 0
.
4. If the integer is greater than2**31 – 1
, then return2**31 – 1
and if the integer is smaller than-231
, thenreturn -231
.
👍4🔥3
° Telegram Formatting °
1. Bold
2. Italic
3. Underline
4. Monospace
5. Spoiler
6. Strikethrough
7. URL or Link
8. Inline Mention
9. Emoji
10. Pre Formatted
11. Pre Formatted(Specified Language)
12. Quote or Blockquote
Happy Coding 👨💻
Telegram supports text formatting in messages using Markdown or HTML. This allows you to style your messages with bold, italic, links, inline code, and more.
› Formatting in HTML
1. Bold
<b>Bold Text</b>
<strong>bold</strong>
2. Italic
<i>Italic Text</i>
<em>italic</em>
3. Underline
<u>Underline Text</u>
4. Monospace
<code>Monospace Text<code>
5. Spoiler
<spoiler>Spoiler Text</spoiler>
6. Strikethrough
<s>Strikethrough Text</s>
<strike>strike</strike>
<del>strike</del>
7. URL or Link
<a href="https://telegram.me/NotCoding">text URL</a>
8. Inline Mention
<a href="tg://user?id=5217486447">inline mention</a>
9. Emoji
<emoji id="123456789abcdef">🐱</emoji>
10. Pre Formatted
<pre>pre-formatted</pre>
11. Pre Formatted(Specified Language)
<pre language="python">pre-formatted</pre>
12. Quote or Blockquote
<blockquote>Quoted text</blockquote>
@NotCoding | @CodesSnippet
Happy Coding 👨💻
🔥2🐳2❤1🌚1
Day 16👾:
Given two stringss1
ands2
consisting of lowercase characters. The task is to check whether two given strings are an anagram of each other or not. An anagram of a string is another string that contains the same characters, only the order of characters can be different. For example,"act"
and"tac"
are an anagram of each other. Stringss1
ands2
can only contain lowercase alphabets.
Note: You can assume both the stringss1 & s2
arenon-empty
.
🔥4👍2
° Telegram Formatting °
1. Bold
2. Italic
3. Underline
4. Monospace
5. Spoiler
6. Strikethrough
7. URL or Link
8. Inline Mention
9. Pre Formatted
10. Quote or Blockquote
Happy Coding 👨💻
Telegram supports text formatting in messages using Markdown or HTML. This allows you to style your messages with bold, italic, links, inline code, and more.
› Formatting in HTML
› Formatting in MARKDOWN
1. Bold
**bold**
2. Italic
__italic__
3. Underline
--underline--
4. Monospace
`inline fixed-width code`
5. Spoiler
||spoiler||
6. Strikethrough
~~strike~~
7. URL or Link
[text URL](https://telegram.me/NotCoding)
8. Inline Mention
[text user mention](tg://user?id=5217486447)
9. Pre Formatted
```
pre-formatted```
10. Quote or Blockquote
> Quoted text
@NotCoding | @CodesSnippet
Happy Coding 👨💻
👍2🔥2🕊2👏1