Day 18👾:
Given two strings, one is a text stringtxt
and the other is a pattern stringpat
. The task is to print the indexes of all the occurrences of the pattern string in the text string. Use0-based
indexing while returning the indices.
Note: Return an empty list in case of no occurrences of pattern.
❤2🔥2🏆2👍1
• Simple Button Effects •
• HTML
• CSS
Happy Coding 👨💻
› Simple button with filling effect using HTML and CSS
• HTML
<button class="btn">
<span>
Hover Me
</span>
</button>
• CSS
html,
body {
display: flex;
justify-content: center;
align-items: center;
background-color: #2b2b2b;
height: 100%;
}
.btn {
background-color: #ffffff;
transform: scale(2);
border: none;
color: #000000;
border-radius: 5px;
overflow: hidden;
position: relative;
z-index: 1;
font-family: cursive;
transition: all 1s ease-in-out;
}
.btn::after {
content: "";
background-image: linear-gradient(
45deg,
#4ea8de,
#48bfe3,
#56cfe1,
#64dfdf,
#72efdd,
#80ffdb
);
height: 100%;
width: 0;
position: absolute;
bottom: 0;
left: 0;
z-index: 0;
transition: all 1s ease-in-out;
}
.btn:hover::after {
width: 100%;
}
.btn:hover {
box-shadow: 0px 0px 10px #4ea8de, 0px 0px 10px #48bfe3, 0px 0px 10px #56cfe1,
0px 0px 10px #64dfdf;
}
.btn span {
position: relative;
z-index: 2;
}
For demo visit Here
· Go and check and add more effect using your knowledge and share (●'◡'●)
@NotCoding | @CodesSnippet
Happy Coding 👨💻
🔥7❤3👍3🎉3🆒2🕊1💋1
GitHub releases the free version of GitHub Copilot 👾🥳
• Check it out!!
› Copilot Chat
› VS Code extension for copilot
@NotCoding | @CodesSnippet
Happy Coding 👨💻
🔥9❤8👍6🎉4🤯1💘1
° Ages of Operating Systems👾 °
Happy Coding 👨💻
📂 Windows 11 (3 years old)
🪟 Windows 10 (8 years old)
🍎 macOS Yosemite (10 years old)
🐉 Kali Linux (11 years old)
💻 Windows 8 (12 years old)
🌐 Manjaro (11 years old)
💻 Windows 7 (14 years old)
🖥️ Windows Vista (17 years old)
🌿 Linux Mint (18 years old)
🐧 Ubuntu (20 years old)
⚙️ Fedora (20 years old)
🔧 OpenSUSE (20 years old)
⚙️ CentOS (20 years old)
🐧 Arch Linux (22 years old)
🍏 macOS (22 years old)
💻 Windows XP (23 years old)
🖥️ Windows 2000 (24 years old)
📱 Windows 98 (25 years old)
🌍 Windows 95 (28 years old)
💻 Windows 3.1 (29 years old)
🖥️ OS/2 (32 years old)
🐧 Debian (31 years old)
🔴 Red Hat Linux (30 years old)
🎮 AmigaOS (34 years old)
🖥️ Xenix (40 years old)
📀 VMS (44 years old)
💾 MS-DOS (42 years old)
💾 CP/M (49 years old)
🖥️ Unix (54 years old)
Created By :- The Coding Wizard
@NotCoding | @CodesSnippet
Happy Coding 👨💻
❤6🔥5👍3🎉2🕊2
• Number Guessing Game •
Happy Coding 👨💻
A number guessing game that will give you infinite chance to guess correct number generated by system, and it will count the number of attempts taken by you!!Code:
Let's test it, and have fun!
This is only for fun and for knowledge on error handling, loops, conditionals operators, etc.
import time
import random
def number_guessing():
comp = random.randint(0, 10)
count = 1
while True:
try:
user_input = int(input("You: "))
if user_input == comp:
print(f"\nCongratulations, You win!!\nThe number is {comp}\nYour number of attempt is {count}")
break
elif user_input > comp:
print("Think smaller number")
count += 1
elif user_input < comp:
print("Think Bigger number")
count += 1
except:
print(f"Invalid input")
def main():
name = input("Enter your name: ")
welcome_msg = f"Hey {name}, This is number guessing gamee developed by Chiku!\nTry it!\nYou have to guess a number from 0 to 10. I'll calculate the number of attempts taken by you!!\nLet's Have fun.\n"
for char in welcome_msg:
print(char, end='', flush=True)
time.sleep(0.05)
print()
number_guessing()
if __name__ == "__main__":
main()
› Try it and do improvement if you have better idea, use your knowledge 🧑💻❣️
@NotCoding | @CodesSnippet
Happy Coding 👨💻
❤2👍2🐳2👏1
• Are You Feeling Lucky? Try This Python Number Guessing Game! 😁 •
· Requirements
· Code (
Happy Coding 👨💻
› Implementation of number guessing game in telegram bot using Pyrofork (a fork repository of pyrogram official)
NOTE: Make sure you created a virtual environment before trying this if you trying in your local mechanic of your existing Pyrogram bot.
If you don't know how to create virtual environment then follow this post on creation of virtual environment!
· Requirements
pip install pyrofork
· Code (
main.py
)from pyrogram import Client, filters
from pyrogram.types import Message, KeyboardButton, ReplyKeyboardMarkup
import random
app = Client(
'bot',
api_id=18551492,
api_hash='9046713fdc162e06212f23e0e2047b4b',
bot_token=''
)
@app.on_message(filters.command('start'))
async def game(client, m: Message):
welcome_msg = f"Hey {m.from_user.first_name}, This is number guessing gamee developed by Chiku!\nTry it!\nYou have to guess a number from 0 to 10. I'll calculate the number of attempts taken by you!!\nLet's Have fun.\n"
button = ReplyKeyboardMarkup(
[
[KeyboardButton("Gamee")]
],
resize_keyboard=True
)
await m.reply(
welcome_msg,
reply_markup=button
)
@app.on_message(filters.regex('Gamee'))
async def gamee(client, m: Message):
comp = random.randint(0, 10)
count = 1
await m.reply("Best of luck buddy!")
while True:
try:
user_input = await client.ask(m.chat.id, "Guess The number: ")
user_input = int(user_input.text)
if user_input == comp:
await m.reply(f"\nCongratulations, You win!!\nThe number is {comp}\nYour number of attempt is {count}")
break
elif user_input > comp:
await m.reply("Think smaller number!")
count += 1
elif user_input < comp:
await m.reply("Think Bigger number!")
count += 1
except:
await m.reply("Invalid Input, Please give a valid number from 0 to 10!")
print("Bot Polling..")
app.run()
· Try to implement and try if you can improvee🧑💻
@NotCoding | @CodesSnippet
Happy Coding 👨💻
👍7🔥4❤3🎉3🍾1👾1
Day 23👾:
Given an array of integersarr[]
. Find the Inversion Count in the array.
Two elementsarr[i]
andarr[j]
form an inversion ifarr[i] > arr[j]
andi < j
.
Inversion Count:
For an array, inversion count indicates how far (or close) the array is from being sorted. If the array is already sorted then the inversion count is 0.
If an array is sorted in the reverse order then the inversion count is the maximum.
❤2👍2👏2
Day 25👾:
Geek has an array of non-overlapping intervals intervals whereintervals[i] = [starti, endi]
represent the start and the end of the ith event and intervals is sorted in ascending order by starti. He wants to add a new intervalnewInterval= [newStart, newEnd]
where newStart and newEnd represent the start and end of this interval.
Help Geek to insert newInterval into intervals such that intervals is still sorted in ascending order by starti and intervals still does not have any overlapping intervals (merge overlapping intervals if necessary).
👏3❤2👍2
Day 31👾:
Given an arrayarr[]
where no two adjacent elements are same, find the index of a peak element. An element is considered to be a peak if it is greater than its adjacent elements (if they exist). If there are multiple peak elements, return index of any one of them. The output will be "true
" if the index returned by your function is correct; otherwise, it will be "false
".
Note: Consider the element before the first element and the element after the last element to be negative infinity.
👍4🥰1👏1