Python Data Science Jobs & Interviews
18.3K subscribers
146 photos
3 videos
17 files
257 links
Your go-to hub for Python and Data Science—featuring questions, answers, quizzes, and interview tips to sharpen your skills and boost your career in the data-driven world.

Admin: @Hussein_Sheikho
Download Telegram
This media is not supported in your browser
VIEW IN TELEGRAM
This media is not supported in your browser
VIEW IN TELEGRAM
The latest and the most up-to-date cyber news will be presented on PPHM HACKER NEWS.
PPHM subscribers are the first people that receive firsthand cybernews and Tech news.

You won't miss any cyber news with us.


https://t.iss.one/pphm_HackerNews
Python Data Science Jobs & Interviews pinned «The latest and the most up-to-date cyber news will be presented on PPHM HACKER NEWS. PPHM subscribers are the first people that receive firsthand cybernews and Tech news. You won't miss any cyber news with us. https://t.iss.one/pphm_HackerNews»
0002)
Anonymous Quiz
73%
1
13%
2
4%
3
11%
4
4😐1
This media is not supported in your browser
VIEW IN TELEGRAM
0003)
Anonymous Quiz
29%
1
44%
2
18%
3
9%
4
modular programming exists in Python too. It helps us organize related code in a clean, maintainable, and scalable way. Let’s learn how to do this step by step in Python.

---

Step 1: Create a Module File

Create a new file called string_utils.py and write related functions inside it:

# string_utils.py

def to_uppercase(s):
return s.upper()

def to_lowercase(s):
return s.lower()

---

Step 2: Use the Module in the Main File

Create another file called main.py and import the functions from string_utils:

# main.py

from string_utils import to_uppercase, to_lowercase

print(to_uppercase("hello")) # Output: HELLO
print(to_lowercase("WORLD")) # Output: world

---

Step 3: Run the Code

To run the program, just execute the following command in your terminal or in an IDE like VS Code:

python main.py

---

Practice:

Now it’s your turn!

1. Create a new file called math_utils.py.
2. Define functions like add, subtract, and multiply inside it.
3. Import and test them in main.py.



⭐️ https://t.iss.one/DataScienceQ
Please open Telegram to view this post
VIEW IN TELEGRAM
👍6
This media is not supported in your browser
VIEW IN TELEGRAM
0004)
Anonymous Quiz
54%
1
13%
2
12%
3
21%
4
👍2
Ace the data science interview

This book available now

Price 10 usdt

Contact @hussein_sheikho
👍2👏1
Correct Answer: Option 1
You will get a runtime error, and the program will crash.

---

📕 Explanation:

In Python, if you attempt to import a module that doesn't exist, the interpreter will raise a runtime error called ModuleNotFoundError. This error immediately stops the execution of the program—unless it is properly handled using a try-except block.

---

🔎 Example:

import my_fake_module


📌 Output:

ModuleNotFoundError: No module named 'my_fake_module'


---

🔓 How to handle the error?

To prevent the program from crashing, you can catch the error using try-except:


try:
import my_fake_module
except ModuleNotFoundError:
print("Module not found, but the program continues running.")


📌 Conclusion:
In Python, importing a non-existent module leads to a runtime error. If not handled, it will crash the program.

🚀 Keep learning one question at a time!
Stay tuned for tomorrow’s question 🔥

🌟 https://t.iss.one/DataScienceQ
Please open Telegram to view this post
VIEW IN TELEGRAM
5👍1🥰1
This media is not supported in your browser
VIEW IN TELEGRAM