• Become A Master Of Error Handling And Use List Comprehension To Calculate Volume

Hello, checkiomates🐱‍👤!

Dive into the complete guide to error handling, make clear when to use list comprehension and try to solve a new difficult mission about calculating volume of 3D figure.

💡TIP

If you find an interesting solution, you may add it to your bookmarks by clicking the flag near solution title. You can find all your bookmarked solutions by clicking your nickame and then "Bookmarks". If you want to discover all CheckiO features, visit our tutorial. It's a longread, but it's worth it!

🏁MISSION

Three Views by kurosawa4434 -

The volume of an object almost derived from three views.
You are given three views (front, right side, top) as input values. Each of these is a string consisting of A to Y. These letters assigned row-major order in a 5x5 grid.
You have to return the total volume of the object.

three_views('BCDGHILMNQRSVWX', 'CHMRW', 'LMN') == 15
three_views('GHILMNQRS', 'GHILMNQRS', 'GHILMNQRS', ) == 27

📖ARTICLES

The Ultimate Guide to Error Handling in Python -

Exceptions in Python is one of those areas that have a surface layer that most people know, and a deeper, almost secret one that a lot of developers don't even know exists. If you want to test yourself on this topic, see if you can answer the following questions:
When should you catch exceptions raised by functions you call, and when should you not?
How can you know what exception classes to catch?
When you catch an exception, what should you do to "handle" it?
Why is catching all exceptions considered a bad practice, and when is it okay to do it?
Are you ready to learn the secrets of error handling in Python? Let's go!

__init__.py files are optional. Here's why you should still use them -

If you’ve ever googled the question “Why do Python packages have empty __init__.py files?”, you could get the idea that Python packages wouldn’t work without them. This is a common misconception—they’ve been optional since Python 3.3! Why then, do most Python projects still have them?

When to Use a List Comprehension in Python Quiz -

By working through this quiz, you’ll revisit how to rewrite loops as list comprehensions, how to choose when to use list comprehensions, how you can use conditional logic in your comprehensions, and how to profile your code to resolve performance questions.

👩‍💻CODE SHOT

How do you think, what the following tricky code does?

"n\";]1-::[x == x :x adbmal=oikcehc ;"; checkio=lambda x: x == x[::-1];"\n"

🙌 Thanks for your attention! Hope to meet you at CheckiO, as well as at our Instagram and Twitter! We are really interested in your thoughts! Please, leave a comment below! ⤵

Welcome to CheckiO - games for coders where you can improve your codings skills.

The main idea behind these games is to give you the opportunity to learn by exchanging experience with the rest of the community. Every day we are trying to find interesting solutions for you to help you become a better coder.

Join the Game