Skip to content

Latest commit

 

History

History
39 lines (21 loc) · 621 Bytes

Parse_nice_int_from_char_problem.md

File metadata and controls

39 lines (21 loc) · 621 Bytes

CodeWars Python Solutions


Parse nice int from char problem

Instructions

Ask a small girl - "How old are you?". She always says strange things... Lets help her!

For correct answer program should return int from 0 to 9.

Assume test input string always valid and may look like "1 year old" or "5 years old", etc.. The first char is number only.


Given Code

def get_age(age):
    pass

Solution

def get_age(age):
    return int("".join([i for i in age if i.isdigit()]))

See on CodeWars.com