본문 바로가기

Python_Matter

(328)
End Zeros Quiz> Try to find out how many zeros a given number has at the end. Input: A positive Int Output: An Int. Example: end_zeros(0) == 1 end_zeros(1) == 0 end_zeros(10) == 1 end_zeros(101) == 0 def end_zeros(num: int) -> int: # your code here return None if __name__ == '__main__': print("Example:") print(end_zeros(0)) # These "asserts" are used for self-checking and not for an auto-testing assert en..
Number Length Quiz> You have a positive integer. Try to find out how many digits it has? Input: A positive Int Output: An Int. Example: number_length(10) == 2 number_length(0) == 1 def number_length(a: int) -> int: # your code here return None if __name__ == '__main__': print("Example:") print(number_length(10)) # These "asserts" are used for self-checking and not for an auto-testing assert number_length(10) ..
Acceptable Password I Quiz> You are the beginning of a password series. Every mission will be based on the previous one. Going forward the missions will become slightly more complex. In this mission you need to create a password verification function. Those are the verification conditions: the length should be bigger than 6. Input: A string. Output: A bool. Example: is_acceptable_password('short') == False is_accepta..
All Upper I Quiz> Check if a given string has all symbols in upper case. If the string is empty or doesn't have any letter in it - function should return True. Input: A string. Output: a boolean. Example: is_all_upper('ALL UPPER') == True is_all_upper('all lower') == False is_all_upper('mixed UPPER and lower') == False is_all_upper('') == True Precondition: a-z, A-Z, 1-9 and spaces def is_all_upper(text: st..
Correct Sentence Quiz> For the input of your function, you will be given one sentence. You have to return a corrected version, that starts with a capital letter and ends with a period (dot). Pay attention to the fact that not all of the fixes are necessary. If a sentence already ends with a period (dot), then adding another one will be a mistake. Input: A string. Output: A string. Example: correct_sentence("gree..
Fizz Buzz Quiz> "Fizz buzz" is a word game we will use to teach the robots about division. Let's learn computers. You should write a function that will receive a positive integer and return: "Fizz Buzz" if the number is divisible by 3 and by 5; "Fizz" if the number is divisible by 3; "Buzz" if the number is divisible by 5; The number as a string for other cases. Input: A number as an integer. Output: The ..
Say Hi Quiz> We have prepared a set of Editor's Choice Solutions. You will see them first after you solve the mission. In order to see all other solutions you should change the filter. In this mission you should write a function that introduces a person with the given parameter's attributes. Input: Two arguments. String and positive integer. Output: String. Example: say_hi("Alex", 32) == "Hi. My name i..
First Word (simplified) Quiz> You are given a string where you have to find its first word. This is a simplified version of the First Word mission. Input string consists of only english letters and spaces. There aren’t any spaces at the beginning and the end of the string. Input: A string. Output: A string. Example: first_word("Hello world") == "Hello" How it is used: The first word is a command in a command line. Prec..