Basic Python

title, items

Naranjito 2022. 6. 29. 14:58
  • title

Converts the first letter of each one to upper case.

def get_full_name(first_name, last_name):
    full_name=first_name.title()+" "+last_name.title()
    return full_name 
print(get_full_name('joohyun','yoon'))

>>>

Joohyun Yoon

 

  • items

It returns the list with all dictionary keys with values.

car = {
  "brand": "Ford",
  "model": "Mustang",
  "year": 1964
}
car.items()

>>>

dict_items([('brand', 'Ford'), ('model', 'Mustang'), ('year', 1964)])

'Basic Python' 카테고리의 다른 글

instancemethod, classmethod, staticmethod  (0) 2022.07.01
TypeError : Can't instantiate abstract class with abstract method  (0) 2022.06.29
tqdm  (0) 2022.04.07
union, intersection  (0) 2022.03.10
swapcase  (0) 2021.12.22