¿La página no carga? Prueba haciendo clic aquí.
Placeholder

#9526
Idioma restringido

문자열1 - 연습문제 5 1s - MB

Problemas

서식 문자를 사용하여 다음과 같이 출력하는 프로그램을 작성하라. 


Ejemplo

창호 170 68.5
창호의 키는 170cm이며, 몸무게는 68.500000kg입니다.
창호의 키는 170cm이며, 몸무게는 68.500000kg입니다.
출력하는 방법은 아래와 같이 여러 방법이 존재한다.
print("%s is %d years old." % ("Bob", 13))
print("{} is {} years old.".format("Bob", 13))
print(f"{'Bob'} is {13} years old.")
print("Bob"+" is "+str(13)+" years old.")
print("Bob","is",13,"years old.")

실수의 경우 아래와 같이 소수 자릿수를 결정할 수 있다.
"%f %.3f" % (3.14, 3.14)
# "3.140000 3.140"  <= %f는 소수점 아래 여섯자리까지를 출력한다.

Fuente

자기주도 파이썬

Debes iniciar sesión para escribir código.