-
[input/string interpolation] 유저에게 인풋을 받아서 프린트하기🐍 파이썬/파이썬 연습문제 2022. 7. 17. 06:58
생각보다 쓰일일이없어서 검색하지않고서는 기억이 안날수있는 문법중에하나인 input function과 헷갈리는 string interpolation !
문제 : Ask from the user the following information: name, age, occupation and print the following message using the provided values: Hi NAME! I see you are AGE years old and work as a OCCUPATION.
# ask and store what the user has typed in a variable name = input('What is your name?') age = input('How old are you?') occupation = input('What is your occupation?') # f-string interpolation print(f'Hi {name}! I see you are {age} years old and work as a {occupation}.')
'🐍 파이썬 > 파이썬 연습문제' 카테고리의 다른 글
[modulo/devisor] sum up digit (0) 2022.07.18 [file] copy the file (0) 2022.07.17 [random/inf loop] guessing game (0) 2022.07.17 [modulo/divisor] Vending machine change 거스름돈 문제 (0) 2022.07.17 [소개글] how to use 파이썬 연습문제 (0) 2022.07.15