반응형 dictionary2 Python Multiple return values (Tuple, Dict) # Question:# Write a program that accepts a sentence and calculate the number #of letters and digits.# Suppose the following input is supplied to the program:# hello world! 123# Then, the output should be:# LETTERS 10# DIGITS 3 [Tuple 이용] def countingStr(sentence): countNum = 0 countChar = 0 for i in range(len(sentence)): if((65 2018. 8. 23. Python Dictionary 자료형 사용해보기 # Make a function lookup_state that, given a US state abbreviation, returns the # state's name.## We've given you a dictionary with abbreviations as keys and state names as values.# It's imported for you here:from US import states## Example:# >>>> lookup_state("NC")# North Carolina def lookup_state(abbreviation): return states.get(abbreviation) # Add print statements to test what your function d.. 2018. 8. 20. 이전 1 다음 반응형