Posts

Showing posts with the label Python Projects

Featured Post

SQL Interview Success: Unlocking the Top 5 Frequently Asked Queries

Image
 Here are the five top commonly asked SQL queries in the interviews. These you can expect in Data Analyst, or, Data Engineer interviews. Top SQL Queries for Interviews 01. Joins The commonly asked question pertains to providing two tables, determining the number of rows that will return on various join types, and the resultant. Table1 -------- id ---- 1 1 2 3 Table2 -------- id ---- 1 3 1 NULL Output ------- Inner join --------------- 5 rows will return The result will be: =============== 1  1 1   1 1   1 1    1 3    3 02. Substring and Concat Here, we need to write an SQL query to make the upper case of the first letter and the small case of the remaining letter. Table1 ------ ename ===== raJu venKat kRIshna Solution: ========== SELECT CONCAT(UPPER(SUBSTRING(name, 1, 1)), LOWER(SUBSTRING(name, 2))) AS capitalized_name FROM Table1; 03. Case statement SQL Query ========= SELECT Code1, Code2,      CASE         WHEN Code1 = 'A' AND Code2 = 'AA' THEN "A" | "A

10 Exclusive Python Projects for Interviews

Image
Here are ten Python projects along with code and possible solutions for your practice. 01. Palindrome Checker: Description: Write a function that checks if a given string is a palindrome (reads the same backward as forward). def is_palindrome(s):     s = s.lower().replace(" ", "")     return s == s[::-1] # Test the function print(is_palindrome("radar"))  # Output: True print(is_palindrome("hello"))  # Output: False 02. Word Frequency Counter: Description: Create a program that takes a text file as input and counts the frequency of each word in the file. def word_frequency(file_path):     with open(file_path, 'r') as file:         text = file.read().lower()         words = text.split()         word_count = {}         for word in words:             word_count[word] = word_count.get(word, 0) + 1     return word_count # Test the function file_path = 'sample.txt' word_count = word_frequency(file_path) print(word_count) 03. Guess the Nu