Sunday, 20 September 2026

Python Coding Challenge - Question with Answer (ID 200926)

 


Explanation:

1. Creating the List

x = [1]
A list containing 1 is created.
x refers to this list.
x → [1]

2. Assigning y = x
y = x

This does not create a new list.

Both variables point to the same list:

x ──┐
    ↓
  [1]
    ↑
y ──┘

So:

x is y

would already be True.

3. Using +=
x += [2]

For a list, += modifies the existing list in place.

The list changes from:

[1]

to:

[1, 2]

Because x and y refer to the same list, y also sees the change:

x ──┐
    ↓
 [1, 2]
    ↑
y ──┘

4. Checking Identity
print(x is y)

The is operator checks whether two variables refer to the same object.

Here:

x → same list ← y

Therefore:

x is y → True
⚡ Complete Flow
x = [1]
   ↓
y = x
   ↓
Both refer to the same list
   ↓
x += [2]
   ↓
Same list becomes [1, 2]
   ↓
x is y
   ↓
True

✅ Final Output:

Python Coding challenge - Day 1253| What is the output of the following Python Code?

 


Code Explanation:

1️⃣ Creating an Empty List
funcs = []

An empty list is created to store functions.

funcs → []

2️⃣ Starting the Loop
for i in range(3):

range(3) produces:

0, 1, 2

So the loop runs three times.

Iteration i
1st 0
2nd 1
3rd 2

3️⃣ Defining the Function
def f():

A function named f is created during each iteration.

The important point is that the function refers to i, which comes from the surrounding scope.

4️⃣ Returning i
return i

The function doesn't store a separate copy of i.

Instead, it closes over the variable i.

This is the main trick in this question.

5️⃣ Storing the Function
funcs.append(f)

The function object is added to funcs.

After all three iterations:

funcs → [f, f, f]

There are three function objects, but they all refer to the same loop variable i.

6️⃣ Calling All Functions
print([f() for f in funcs])

Now the functions are called.

By this time, the loop has already finished:

i = 2

Therefore each function reads the current value of i:

f() → 2
f() → 2
f() → 2
๐Ÿ”ฅ Why Isn't the Output [0, 1, 2]?

This is called late binding.

The functions don't capture the value of i at each iteration. They look up i when the function is called.

Loop:
i = 0 → create f
i = 1 → create f
i = 2 → create f

After loop:
i = 2

Calls:
f() → 2
f() → 2
f() → 2

✅ Final Output
[2, 2, 2]

Python Coding challenge - Day 1252| What is the output of the following Python Code?

 


Code Explanation:

1️⃣ Creating the Global Variable

x = 10

Here, x is created in the global scope.

x → 10

It can be accessed from anywhere in the program unless a local variable with the same name hides it.

2️⃣ Defining the Function
def change():

This creates a function named change.

The function is only defined at this point. Its body hasn't executed yet.

3️⃣ Using global
global x

This is the key line.

It tells Python:

"Inside this function, x refers to the global variable, not a new local variable."

Without global x, the assignment in the next line would make x local to the function.

4️⃣ Updating x
x += 5

This is equivalent to:

x = x + 5

Because of global x, Python uses the global x.

So:

x = 10 + 5
  = 15

Now the global variable becomes:

x → 15

5️⃣ Calling the Function
change()

Now the function actually executes.

The flow is:

change()
   ↓
global x
   ↓
x = 10 + 5
   ↓
x = 15

6️⃣ Printing x
print(x)

The global x was changed from 10 to 15.

Therefore:

✅ Final Output
15

Python Coding challenge - Day 1251| What is the output of the following Python Code?

 


Code Explanation:

Line 1 — Create Class A
class A:
class keyword is used to create a class.
A is the name of the parent class.
This class contains a method called show().

Line 2 — Define show() Method
def show(self):
def is used to define a function or method.
show() is a method of class A.
self refers to the current object.

Line 3 — Return "A"
return "A"
Whenever show() from class A is called, it returns the string "A".

For example:

obj = A()
print(obj.show())

Output:

A

Line 4 — Create Class B from A
class B(A):
Class B inherits from class A.
A is the parent class.
B is the child class.
Because of inheritance, B can access methods from A.

Line 5 — Define show() Again
def show(self):
Class B defines its own show() method.
This method has the same name as the method in class A.
This is called method overriding.

Line 6 — Return "B"
return "B"
When show() is called through a B object, Python uses the show() method defined inside B.
Therefore, it returns "B" instead of "A".

Line 7 — Create Object of B
x = B()
An object named x is created from class B.
Since B inherits from A, the object can also access inherited features.
However, B has its own version of show().

Line 8 — Call show() and Print Result
print(x.show())
x.show() calls the show() method.
Since x is an object of class B, Python finds the overridden show() method in B.
That method returns "B".
print() displays the returned value.

Output
B

400 Days Python Coding Challenges with Explanation

Saturday, 19 September 2026

14 Best GitHub Profiles Every Python, Data Science & AI Developer Should Follow

 


GitHub is more than just a platform for storing code. It's a place to learn from experienced developers, explore open-source projects, and improve your programming skills.

Whether you're learning Python, exploring Data Science, building AI applications, or contributing to open source, following the right GitHub profiles can help you discover valuable resources.

In this blog, let's explore 14 GitHub profiles worth following in 2026.


๐Ÿ Python & Data Science GitHub Profiles

1. Wes McKinney — Creator of pandas

๐Ÿ”— GitHub: https://github.com/wesm

Wes McKinney is the creator of pandas, one of the most widely used Python libraries for data analysis.

Explore his GitHub profile to learn more about his work in data analysis and scientific computing.

Perfect for: Python, Pandas, Data Analysis.


2. Jake VanderPlas — Scientific Python & Data Science

๐Ÿ”— GitHub: https://github.com/jakevdp

Jake VanderPlas is known for his contributions to the scientific Python ecosystem and data science education.

His work covers scientific computing, visualization, and machine learning.

Perfect for: NumPy, Scientific Python, Data Science.


3. Tirthajyoti Sarkar — Machine Learning & Python

๐Ÿ”— GitHub: https://github.com/tirthajyoti

Explore Python projects, machine learning resources, and data science-related repositories.

This profile can be useful for developers looking for practical learning materials.

Perfect for: Machine Learning, Python, Data Science.


4. Andrej Karpathy — AI & Deep Learning

๐Ÿ”— GitHub: https://github.com/karpathy

Andrej Karpathy is known for his work in deep learning and AI education.

His repositories include projects and educational resources that help developers understand modern AI concepts.

Perfect for: Deep Learning, Neural Networks, AI.


5. Manu Joseph — Machine Learning

๐Ÿ”— GitHub: https://github.com/manujosephv

Explore machine learning-related projects, including work associated with PyTorch Tabular.

Perfect for: Machine Learning, PyTorch, Data Science.


๐Ÿค– AI & Machine Learning GitHub Profiles

6. Hugging Face — Open-Source AI

๐Ÿ”— GitHub: https://github.com/huggingface

Hugging Face provides open-source tools and libraries for machine learning, natural language processing, and AI development.

Developers can explore popular projects such as Transformers and other machine learning tools.

Perfect for: NLP, LLMs, Transformers, AI.


7. OpenAI — AI Research & Tools

๐Ÿ”— GitHub: https://github.com/openai

Explore OpenAI's public GitHub repositories, which include open-source projects and developer tools.

Perfect for: AI Development, Machine Learning, Open Source.


8. Microsoft — Cloud, AI & Developer Tools

๐Ÿ”— GitHub: https://github.com/microsoft

Microsoft maintains a wide range of open-source repositories covering AI, cloud computing, developer tools, and programming languages.

Perfect for: AI, Cloud Computing, Software Development.


9. Google — AI & Open Source

๐Ÿ”— GitHub: https://github.com/google

Explore Google's public repositories, covering software development, AI, machine learning, and other open-source projects.

Perfect for: AI, Machine Learning, Open Source.


๐Ÿ’ป Programming & Open Source GitHub Profiles

10. Sindre Sorhus — Open Source Developer

๐Ÿ”— GitHub: https://github.com/sindresorhus

Sindre Sorhus is a prolific open-source developer known for a large collection of JavaScript and Node.js packages.

Perfect for: JavaScript, Node.js, Open Source.


11. freeCodeCamp — Programming Education

๐Ÿ”— GitHub: https://github.com/freeCodeCamp

freeCodeCamp offers free programming education and maintains open-source learning resources.

Developers can explore educational content and contribute to the project.

Perfect for: Programming, Web Development, Beginners.


12. Real Python — Python Learning Resources

๐Ÿ”— GitHub: https://github.com/realpython

Real Python is a popular Python education platform.

Its GitHub profile provides access to public repositories and learning-related resources.

Perfect for: Python, Tutorials, Programming Education.


13. The Algorithms — Algorithms in Multiple Languages

๐Ÿ”— GitHub: https://github.com/TheAlgorithms

The Algorithms organization provides algorithm implementations in multiple programming languages.

It's a useful place to explore algorithms, data structures, and programming concepts.

Perfect for: Data Structures, Algorithms, Problem Solving.


14. Donnemartin — Data Engineering & Python

๐Ÿ”— GitHub: https://github.com/donnemartin

Explore repositories related to Python, software development, and data engineering.

Perfect for: Python, Data Engineering, Software Development.


๐ŸŽฏ Why Should You Follow GitHub Profiles?

Following developers and organizations on GitHub can help you:

✅ Discover real-world coding projects
✅ Learn from open-source contributors
✅ Improve your programming skills
✅ Explore new Python libraries
✅ Understand software development practices
✅ Find resources for AI and Data Science
✅ Contribute to open-source projects

GitHub is one of the best places to learn by exploring real code.


๐Ÿš€ How to Start Learning from GitHub

If you're a beginner, follow these simple steps:

Step 1: Choose a GitHub profile related to your interests.

Step 2: Explore their repositories.

Step 3: Read the README files to understand each project.

Step 4: Run the code on your local machine or in Jupyter Notebook.

Step 5: Try modifying the project and building something of your own.

Step 6: Contribute to open source when you're ready.

๐Ÿ Python Pattern Challenge — Day 7

 


๐Ÿ Python Pattern Challenge — Day 7

Pattern printing is a great way to strengthen your Python logic, loops, conditions, and problem-solving skills. Today’s challenge takes things a step further by combining increasing and decreasing patterns with conditional star placement.

Instead of simply filling every row, you’ll need to carefully control where the stars appear and where spaces are placed.

Today's Challenge

Write a Python program to print:

 

Best and cleanest code will be rewarded! ๐Ÿ†


Solution 1 — Using for Loop

n = 4


for i in range(1, n + 1): if i == 1: print(" " * (n - i) * 2 + "*") elif i == n: print("* " * (2 * i - 1)) else: print(" " * (n - i) * 2 + "* " + " " * (i - 2) + "*") for i in range(n - 1, 0, -1): if i == 1: print(" " * (n - i) * 2 + "*") elif i == n: print("* " * (2 * i - 1)) else: print(" " * (n - i) * 2 + "* " + " " * (i - 2) + "*")







How it works:

  • " " * (n - i) * 2 → controls the indentation.
  • The first row contains a single *.
  • The middle row is completely filled.
  • The other rows print stars only at the required positions.
  • The second loop reverses the pattern to create the lower half.

The pattern therefore grows and then shrinks:

1 → 3 → 2 → 5 → 2 → 3 → 1

Solution 2 — Using Nested Loops

n = 4 for i in range(1, n + 1): for j in range(n - i): print(" ", end="") for j in range(2 * i - 1): if i == 1 or i == n or j == 0 or j == 2 * i - 2: print("*", end=" ") else: print(" ", end=" ") print() for i in range(n - 1, 0, -1): for j in range(n - i): print(" ", end="") for j in range(2 * i - 1): if i == 1 or i == n or j == 0 or j == 2 * i - 2: print("*", end=" ") else: print(" ", end=" ") print()












How it works:

Here, nested loops control different parts of the pattern:

  • First loop → controls the leading spaces.
  • Second loop → controls the width of each row.
  • j == 0 → prints the left boundary.
  • j == 2 * i - 2 → prints the right boundary.
  • i == n → creates the completely filled middle row.

This is a great exercise for understanding how conditions work inside nested loops.


Solution 3 — Using String Formatting

n = 4 for i in list(range(1, n + 1)) + list(range(n - 1, 0, -1)): spaces = " " * (n - i) if i == 1: print(spaces + "*") elif i == n: print("* " * (2 * i - 1)) else: print(spaces + "* " + " " * (i - 2) + "*")








How it works:

Instead of writing two separate loops, we create one increasing-and-decreasing sequence:

1, 2, 3, 4, 3, 2, 1

Then each value determines the structure of that row.

This keeps the code compact and reusable.


⚡ Short & Clean Code

n = 4 for i in list(range(1, n + 1)) + list(range(n - 1, 0, -1)): if i in (1, n): print(" " * (n - i) + ("* " * (2 * i - 1)).rstrip()) else: print(" " * (n - i) + "* " + " " * (i - 2) + "*")




๐Ÿ”ฅ One main loop handles both the upper and lower portions of the pattern.


๐Ÿš€ Challenge Yourself

Can you modify this pattern:

  • Create a perfect hollow diamond?
  • Replace * with numbers?
  • Use a while loop?
  • Take the size using input()?
  • Create the pattern using only one loop?
  • Print the pattern using minimum possible code?

Drop your solution below! ๐Ÿ‘‡

Learn • Practice • Grow with CLCODING ๐Ÿ๐Ÿ’ป

Popular Posts

Categories

100 Python Programs for Beginner (119) AI (345) Android (25) AngularJS (1) Api (7) Assembly Language (2) aws (31) Azure (12) BI (10) book (1) Books (359) Bootcamp (14) C (78) C# (12) C++ (83) cloud (1) Course (93) Coursera (305) Cybersecurity (36) data (10) Data Analysis (46) Data Analytics (31) data management (16) Data Science (433) Data Strucures (18) Deep Learning (220) Django (16) Downloads (3) edx (21) Engineering (15) Euron (30) Events (9) Excel (24) Finance (13) flask (4) flutter (1) FPL (17) Generative AI (77) Git (13) Google (55) Hadoop (3) HTML Quiz (1) HTML&CSS (48) IBM (43) IoT (3) IS (25) Java (99) Leet Code (4) Machine Learning (404) Meta (24) MICHIGAN (5) microsoft (13) Nvidia (8) Pandas (16) PHP (20) Projects (35) Python (1375) Python Coding Challenge (1245) Python Library (3) Python Mathematics (17) Python Mistakes (51) Python Pattern Challenge (6) Python Quiz (636) Python Tips (112) Questions (3) R (72) React (7) Scripting (3) security (4) Selenium Webdriver (4) Software (21) SQL (55) Udemy (22) UX Research (1) web application (11) Web development (9) web scraping (3)

Followers

Python Coding for Kids ( Free Demo for Everyone)