-
Join us in Good Time Spending with new Missions and Topics!
Hello, checkiomates๐ฑโ๐ค!
I hope, you missed the new missions! ๐ญ So, here they are: you need to switch key-value pairs in dictionary and play with text to correct capital letter and remove repeated letters. Hurry to solve them!๐โโ๏ธ
There is also a usual portion of topics to read, upgrade your Python background and discuss at comments!
So, let's start with...๐ NEW MISSIONS:
Switch Keys to Values by freeman_lex - where you are given a dictionary, where keys and values are strings. Your function should return a dictionary as well, where keys and values from input dictionary are switched: input keys become output values and vice versa. Looks easy? It is so! The only thing left to mention: the values in the result dictionary should be sets (so the input key(s) - the element(s) of the set).
switch_dict({"rouses": "red", "car": "red", "sky": "blue"}) == { "red": {"rouses", "car"}, "blue": {"sky"}, } switch_dict({"1": "one", "2": "two", "3": "one", "4": "two"}) == { "one": {"3", "1"}, "two": {"4", "2"}, } switch_dict({"a": "b", "b": "c", "c": "a"}) == { "b": {"a"}, "c": {"b"}, "a": {"c"}, }
Long Pressed by Doppelok - you are given two strings here. The first string is the original text message. The second string is a printed message, which may contain several (or possibly none) long-pressed letters. It may happen that the message was written in a hurry, so do not forget to check that all the letters match those in the original. Return True if the printed message matches the original one, taking into account possible long keystrokes. Or False if there are errors or no long-pressed letters.
long_pressed("alex", "aaleex") == True long_pressed("welcome to checkio", "weeeelcome to cccheckio") == True long_pressed("there is an error here", "there is an errorrr hereaa") == False
Correct Capital by Doppelok - you are given a word in which letters can be in different cases. Your task is to check whether the case was used correctly in the line. If everything is correct - return True, if there are errors - return False.
correct_capital("Checkio") == True correct_capital("CheCkio") == False correct_capital("CHECKIO") == True
๐กAnd here are the LINKS we hope will be useful for you!
Python Names and Values - This topic is not new, but describes so fundamental and unchangeable things, that are always useful to gain deeper understanding of processes! As seen from the title, it's about what is "under the hood", when you assign names and values in Python and what surprises may appear.
The dangers of assert in Python - This topic is about asserts statement, it's purpose, examples of safe and unsafe usage. The first will definitely be useful for beginners and the second - for more experienced users.
Python Developers Survey 2022 - We offer you to take part in the sixth iteration of the official Python Developers Survey! The survey is run by JetBrains for the Python Software Foundation, and getting responses from a wide range of users is very helpful for knowing who is using Python and how, and what is helpful to you!
๐ See ya on some CheckiO island! ๐
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