-
Reverse Vowels in The Champernowne Word And Debug The Result!
Hello, checkiomates🐱👤!
We would like to inform you that yesterday the site experienced difficulties related to the system update. Now all the problems have been fixed and the site is working as usual!
Also, we've just launched our brand-new Instagram page! 🎉 Follow us @playcheckio for exclusive updates, join the journey and be part of our community! 🌟
Did you know, that we allow users to assign hotkeys to "Run Code", "Check Solution" and stop code. You may see current combinations on buttons and change them in editor menu... If you want to discover all CheckiO features, visit our tutorial. It's a longread, but it's worth it!
🏁 MISSIONS:
In today's missions you need to practice Reverse Polish Notation - alternative order of mathematical operations, reverse vowels it string, keeping consonants in place and find the distinct character in the Champernowne word.
Postfix Evaluation by freeman_lex - When arithmetic expressions are given in the familiar infix notation 2 + 3 × 4, parentheses nudge the different evaluation order to differ from the usual PEMDAS order determined by precedence and associativity of each operator. The alternative postfix notation (also known as Reverse Polish Notation) may first look weird to people accustomed to the conventional infix. However, postfix notation turns out to be easier for machines, since it allows encoding any intended evaluation order without any parentheses!
A postfix expression is given as list of items that can be either individual integers, or one of the strings '+', '-', '*' and '/' to denote the four basic arithmetic operators. To evaluate a postfix expression use an initially empty stack. Loop through the items one by one, from left to right. Whenever the current item is an integer, just append it to the end of the list. Otherwise, pop two items from the end of the list to perform that operation on, and append the result back to the list. Assuming that items is a legal postfix expression, which is guaranteed in this problem so that you don’t need to perform any error detection or recovery, once all items have been processed, the lone number left in the stack becomes the final answer.
postfix_evaluate([2, 3, "+", 4, "*"]) == 20 postfix_evaluate([2, 3, 4, "*", "+"]) == 14 postfix_evaluate([3, 3, 3, "-", "/", 42, "+"]) == 42
Revorse the vewels by freeman_lex - Given a text string, create and return a new string constructed by finding all its vowels and reversing their order, while keeping all other characters exactly as they were in their original positions. To make the result more presentable, the capitalization of each position must remain the same as it was in the original text.
reverse_vowels("Bengt Hilgursson") == "Bongt Hulgirssen" reverse_vowels("Why do you laugh? I chose death.") == "Why da yee loigh? U chasu dooth."
Champernowne Word by freeman_lex - The Champernowne word 1234567891011121314151617181920212223…, also known as the counting series, is an infinitely long string of digits made up of all positive integers written out in ascending order without any separators. This function should return the digit at position n of the Champernowne word. Position counting again starts from zero.
counting_series(0) == 1 counting_series(10) == 0 counting_series(100) == 5
💡ARTICLES:
Read about integer division from Guido van Rossum, integer division and list/map comparisom.
Why Python's Integer Division Floors - This article of Guido van Rossum on the Python History blog talks about why the decision was made to have integer division use floors, instead of truncation like C.
Python Map vs List Comprehension – The Difference Between the Two - In this tutorial, we’ll explain the difference between Python map vs list comprehension. Both map and list comprehensions are powerful tools in Python for applying functions to each element of a sequence.
Debugging Python - Tips for debugging Python, based on a talk done at PyCon Sweden. Learn how to be better at debugging your Python code!
Everyone starts from this)
🙌 Thanks for your attention! Hope to meet you at CheckiO. 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