Remove All Duplicate Letters from a String in Python
input_str = "programming"
result = ""
for char in input_str:
if char not in result:
result += char
print("String after removing duplicates:", result)
Output:
String after removing duplicates: progamin
Explaination:- https://youtube.com/shorts/zZ1sXTIg2mg
input_str = "programming"
result = ""
for char in input_str:
if char not in result:
result += char
print("String after removing duplicates:", result)
Output:
String after removing duplicates: progamin
Explaination:- https://youtube.com/shorts/zZ1sXTIg2mg
YouTube
Remove All Duplicate Letters from a String in Python
Remove All Duplicate Letters from a String – One Line Python Trick! In this quick Python tutorial, you’ll learn how to remove all duplicate letters from a st...
Find the first Non repeating character in a string
txt = "teeter"
for c in txt:
if txt.count(c) == 1:
print("First non-repeating:", c)
break
Output:
First non-repeating: r
Explanation:- https://youtube.com/shorts/H0VABWdyswY
txt = "teeter"
for c in txt:
if txt.count(c) == 1:
print("First non-repeating:", c)
break
Output:
First non-repeating: r
Explanation:- https://youtube.com/shorts/H0VABWdyswY
YouTube
Find the First Non-Repeating Character in a String in Python | Quick Python Hack!"
Find the first non-repeating character in a string easily with this simple Python tutorial! In this quick guide, you will learn how to write a Python program...
Check if a String Contains Only Digits or not in Python
txt = "123456"
print(txt.isdigit())
Output:
True
Explaination: https://youtube.com/shorts/eSllOxJHEv0
txt = "123456"
print(txt.isdigit())
Output:
True
Explaination: https://youtube.com/shorts/eSllOxJHEv0
YouTube
Check if a String Contains Only Digits or not in Python | Simple Python Trick!
Check if a string contains only digits using this quick and easy Python tutorial! In this short video, you will learn how to write Python code to validate wh...
Find the Longest Word in a Sentence
txt = "Python is a powerful language"
words = txt.split()
longest = max(words, key=len)
print("Longest word:", longest)
Output:
Longest word: powerful
Explaiantion:- https://www.youtube.com/shorts/GKFNSAueTS8
txt = "Python is a powerful language"
words = txt.split()
longest = max(words, key=len)
print("Longest word:", longest)
Output:
Longest word: powerful
Explaiantion:- https://www.youtube.com/shorts/GKFNSAueTS8
YouTube
Find the Longest Word in a Sentence in Python | Quick Coding Trick
Find the longest word in a sentence using Python with this quick and easy tutorial! In this short video, you will learn how to write simple Python code to id...
Capitalize the FirstLetter of Each Word in a String in Python
txt = "python is fun"
result = txt.title()
print(result)
Output:
Python Is Fun
Explaination:- https://www.youtube.com/shorts/aLtlsC-x9gk
txt = "python is fun"
result = txt.title()
print(result)
Output:
Python Is Fun
Explaination:- https://www.youtube.com/shorts/aLtlsC-x9gk
YouTube
Capitalize the First Letter of Each Word in a String in Python!
Capitalize the first letter of each word in a string easily using Python! In this quick tutorial, you will learn how to write a simple Python program to tran...
Check if a String is a Valid Palindrome After Removing Non-Alphanumeric Characters in Python
import re
txt = "A man, a plan, a canal: Panama"
clean = re.sub(r'[^a-zA-Z0-9]', '', txt).lower()
print(clean == clean[::-1])
Output:
True
Explaination:- https://www.youtube.com/shorts/rlO57Nw9tP4
import re
txt = "A man, a plan, a canal: Panama"
clean = re.sub(r'[^a-zA-Z0-9]', '', txt).lower()
print(clean == clean[::-1])
Output:
True
Explaination:- https://www.youtube.com/shorts/rlO57Nw9tP4
YouTube
Check if a String is a Valid Palindrome After Removing Non-Alphanumeric Characters in Python
Check if a string is a valid palindrome after removing non-alphanumeric characters using Python with this quick and easy tutorial! In this video, you will le...
Compress a String in Python
txt = "aaabb"
result = ""
count = 1
for i in range(len(txt)):
if i+1 < len(txt) and txt[i] == txt[i+1]:
count += 1
else:
result += txt[i] + str(count)
count = 1
print(result)
Output: a3b2
Explaination:- https://youtube.com/shorts/HcbYoxCOCRw
txt = "aaabb"
result = ""
count = 1
for i in range(len(txt)):
if i+1 < len(txt) and txt[i] == txt[i+1]:
count += 1
else:
result += txt[i] + str(count)
count = 1
print(result)
Output: a3b2
Explaination:- https://youtube.com/shorts/HcbYoxCOCRw
YouTube
Compress a String in Python Like a PRO in 60 Seconds!
Compress a string in Python is one of the easiest coding challenges you can master in just a few minutes, and in this YouTube Shorts tutorial, I’ll show you ...
Count the Number of Digits in an Integer in Python
num = 12345
print(len(str(num)))
Output: 5
Explaination:- https://youtube.com/shorts/5LN_JZNlYqo
num = 12345
print(len(str(num)))
Output: 5
Explaination:- https://youtube.com/shorts/5LN_JZNlYqo
YouTube
Count the Number of Digits in an Integer in Python in 30 Seconds!
Count the number of digits in an integer in Python with this super simple trick you can master in just 30 seconds! In this YouTube Shorts tutorial, I’ll show...
Find Maximum Digit in a Number Using Built in Function
num = 59284
print(int(max(str(num))))
Output: 9
Explaination:- https://youtube.com/shorts/cz4UDAzmhFw
num = 59284
print(int(max(str(num))))
Output: 9
Explaination:- https://youtube.com/shorts/cz4UDAzmhFw
YouTube
Python One-Liner Tutorial | Find Maximum Digit in a Number Using Built in Function
If you’ve ever wondered how to find the maximum digit in a number using built in function in Python, this video is for you! 🚀 In this quick and simple tutor...
Find Maximum Digit in a Number Without Built in Function
num = 59284
max_digit = 0
while num > 0:
digit = num % 10
if digit > max_digit:
max_digit = digit
num = num // 10
print(max_digit)
Output: 9
Explaination:- https://youtube.com/shorts/xjZfaV7Xdjk
num = 59284
max_digit = 0
while num > 0:
digit = num % 10
if digit > max_digit:
max_digit = digit
num = num // 10
print(max_digit)
Output: 9
Explaination:- https://youtube.com/shorts/xjZfaV7Xdjk
YouTube
Find Maximum Digit in a Number Without Built in Functions
If you want to find the maximum digit in a number without built in functions in Python, this quick tutorial is perfect for you! In this video, we break down ...
Find the Factors of a Number in Python
num = 12
for i in range(1, num+1):
if num % i == 0:
print(i)
Output:
1
2
3
4
6
12
Explaination:- https://youtube.com/shorts/qvt2EB5_4b4
num = 12
for i in range(1, num+1):
if num % i == 0:
print(i)
Output:
1
2
3
4
6
12
Explaination:- https://youtube.com/shorts/qvt2EB5_4b4
YouTube
Find the Factors of a Number in Python
If you want to find the factors of a number in Python, this beginner-friendly tutorial will show you how in the simplest way possible! We’ll go step by step ...
Find GCD of Two Numbers in Python
import math
a = int(input("Enter first number: "))
b = int(input("Enter second number: "))
result = math.gcd(a, b)
print("GCD of", a, "and", b, "is:", result)
Output
Input → 12, 18
GCD of 12 and 18 is: 6
Explaination:- https://youtube.com/shorts/QGd32oNoz6k
import math
a = int(input("Enter first number: "))
b = int(input("Enter second number: "))
result = math.gcd(a, b)
print("GCD of", a, "and", b, "is:", result)
Output
Input → 12, 18
GCD of 12 and 18 is: 6
Explaination:- https://youtube.com/shorts/QGd32oNoz6k
YouTube
Find GCD of Two Numbers in Python
Find GCD of two numbers in Python easily with this quick and clear tutorial! In this YouTube Shorts video, we show you a simple and efficient method to calcu...
Find LCM of Two Numbers in Python
import math
a = int(input("Enter first number: "))
b = int(input("Enter second number: "))
gcd = math.gcd(a, b)
lcm = (a * b) // gcd
print("LCM of", a, "and", b, "is:", lcm)
Output
Input → 12, 18
LCM of 12 and 18 is: 36
Explaination:- https://youtube.com/shorts/N17ktpEOMoI
import math
a = int(input("Enter first number: "))
b = int(input("Enter second number: "))
gcd = math.gcd(a, b)
lcm = (a * b) // gcd
print("LCM of", a, "and", b, "is:", lcm)
Output
Input → 12, 18
LCM of 12 and 18 is: 36
Explaination:- https://youtube.com/shorts/N17ktpEOMoI
YouTube
Find LCM of Two Numbers in Python
Find LCM of Two Numbers in PythonFind LCM of two numbers in Python easily with this quick and clear tutorial! In this YouTube Shorts video, you’ll learn a si...
Check Whether a Number is Palindrome or Not
num = 121
temp = num
rev = 0
while num > 0:
digit = num % 10
rev = rev * 10 + digit
num = num // 10
if temp == rev:
print("Palindrome")
else:
print("Not Palindrome")
Output
Input → 121 → Palindrome
Input → 123 → Not Palindrome
Explaination:- https://youtube.com/shorts/Aql1suBSlys
num = 121
temp = num
rev = 0
while num > 0:
digit = num % 10
rev = rev * 10 + digit
num = num // 10
if temp == rev:
print("Palindrome")
else:
print("Not Palindrome")
Output
Input → 121 → Palindrome
Input → 123 → Not Palindrome
Explaination:- https://youtube.com/shorts/Aql1suBSlys
YouTube
Check Whether a Number is Palindrome or Not
Check Whether a Number is Palindrome or Not Check whether a number is palindrome or not using Python with this short and easy tutorial! In this YouTube Short...
Find Square & Cube of Number | Python
num = 5
square = num ** 2
cube = num ** 3
print("Square:", square)
print("Cube:", cube)
Output
Input → 5
Square: 25
Cube: 125
Explaination:- https://youtube.com/shorts/bXydwbsH5eY
num = 5
square = num ** 2
cube = num ** 3
print("Square:", square)
print("Cube:", cube)
Output
Input → 5
Square: 25
Cube: 125
Explaination:- https://youtube.com/shorts/bXydwbsH5eY
YouTube
Find Square & Cube of Number | Python
Python Program to Find Square & Cube of Number is a quick and easy tutorial that helps beginners understand how to calculate both the square and cube of any ...
Calculate the Average of N Numbers
n = int(input("How many numbers? "))
numbers = []
for i in range(n):
num = float(input("Enter number: "))
numbers.append(num)
total = sum(numbers)
average = total / n
print("Average =", average)
Output
Input → 5 numbers: 10, 20, 30, 40, 50
Average = 30.0
Explaination:- https://youtube.com/shorts/g3ddbmTOyBk
n = int(input("How many numbers? "))
numbers = []
for i in range(n):
num = float(input("Enter number: "))
numbers.append(num)
total = sum(numbers)
average = total / n
print("Average =", average)
Output
Input → 5 numbers: 10, 20, 30, 40, 50
Average = 30.0
Explaination:- https://youtube.com/shorts/g3ddbmTOyBk
YouTube
Calculate the Average of N Numbers | Python in 60 Seconds!
Calculate the Average of N Numbers | Python in 60 Seconds! — In this quick Python Short, you’ll learn how to calculate the average (mean) of any number of va...
Convert a Decimal Number to Binary
num = int(input("Enter a number: "))
binary = bin(num)
print("Binary with prefix:", binary)
print("Binary without prefix:", binary[2:])
Output
Input → 10
Binary with prefix: 0b1010
Binary without prefix: 1010
Explaination:- https://youtube.com/shorts/ExCnEOeiRoM
num = int(input("Enter a number: "))
binary = bin(num)
print("Binary with prefix:", binary)
print("Binary without prefix:", binary[2:])
Output
Input → 10
Binary with prefix: 0b1010
Binary without prefix: 1010
Explaination:- https://youtube.com/shorts/ExCnEOeiRoM
YouTube
Convert a Decimal Number to Binary | Python in 60 Seconds!
Convert a Decimal Number to Binary | Python in 60 Seconds! — In this lightning-fast YouTube Short you'll learn a clean, practical way to convert any decimal ...
Day 1 - Find Sum of N Odd Numbers
def sum_odd_numbers(n):
return n * n
print(sum_odd_numbers(5)) # 25
Output
Input → 5
Output → 25
Explaination:- https://youtube.com/shorts/jTcG6qdsezg
def sum_odd_numbers(n):
return n * n
print(sum_odd_numbers(5)) # 25
Output
Input → 5
Output → 25
Explaination:- https://youtube.com/shorts/jTcG6qdsezg
YouTube
Day 1 - Find Sum of N Odd Numbers in Just 1 Minute!
Day 1 - Find Sum of N Odd Numbers is the perfect quick-start coding challenge for beginners! In this YouTube Short, you’ll learn how to calculate the sum of ...
Day 2 - Find Sum of N Even Numbers
def sum_even_numbers(n):
return n * (n + 1)
print(sum_even_numbers(5)) # 30
Output
Input → 5
Output → 30
Explaination:- https://youtube.com/shorts/GzKIyDgCZFk
def sum_even_numbers(n):
return n * (n + 1)
print(sum_even_numbers(5)) # 30
Output
Input → 5
Output → 30
Explaination:- https://youtube.com/shorts/GzKIyDgCZFk
YouTube
Day 2 - Find Sum of N Even Numbers in Just 1 Minute!
Day 2 - Find Sum of N Even Numbers is your next quick and fun coding challenge! 💻 In this YouTube Short, you’ll learn how to calculate the sum of the first ...
Day 3 - Convert Binary to Decimal in Just 1 Minute!
def binary_to_decimal(binary_str):
decimal = 0
power = len(binary_str) - 1
for digit in binary_str:
decimal += int(digit) * (2 ** power)
power -= 1
return decimal
print(binary_to_decimal("1010")) # 10
print(binary_to_decimal("1111")) # 15
Output
Input → "1010" → Output → 10
Input → "1111" → Output → 15
Explaination:- https://youtube.com/shorts/b6t5G9AV71w
def binary_to_decimal(binary_str):
decimal = 0
power = len(binary_str) - 1
for digit in binary_str:
decimal += int(digit) * (2 ** power)
power -= 1
return decimal
print(binary_to_decimal("1010")) # 10
print(binary_to_decimal("1111")) # 15
Output
Input → "1010" → Output → 10
Input → "1111" → Output → 15
Explaination:- https://youtube.com/shorts/b6t5G9AV71w
YouTube
Day 3 - Convert Binary to Decimal in Just 1 Minute!
Day 3 - Convert Binary to Decimal is a quick and easy coding tutorial designed to help beginners understand number system conversion in under a minute! 💻 In...
Day 4 - Convert Octal to Decimal in Just 1 Minute!
def octal_to_decimal(octal_str):
decimal = 0
power = len(octal_str) - 1
for digit in octal_str:
decimal += int(digit) * (8 ** power)
power -= 1
return decimal
print(octal_to_decimal("12")) # 10
print(octal_to_decimal("77")) # 63
Output
Input → "12" → Output → 10
Input → "77" → Output → 63
Explaination:- https://youtube.com/shorts/2uqOZSl40Ms
def octal_to_decimal(octal_str):
decimal = 0
power = len(octal_str) - 1
for digit in octal_str:
decimal += int(digit) * (8 ** power)
power -= 1
return decimal
print(octal_to_decimal("12")) # 10
print(octal_to_decimal("77")) # 63
Output
Input → "12" → Output → 10
Input → "77" → Output → 63
Explaination:- https://youtube.com/shorts/2uqOZSl40Ms
YouTube
Day 4 - Convert Octal to Decimal in Just 1 Minute!
Day 4 - Convert Octal to Decimal is a quick and easy Python coding tutorial that teaches you how to convert octal numbers (base 8) into decimal numbers (base...