Computer Science/Jongol (정올)

[Jongol] 기초다지기 - 입출력

꿈꾸는어린이 2018. 1. 1. 19:57

JONGOL 508 : 출력 - 자가진단 8



  print("%10s%10s%10s" % ("item", "count", "price"))
print("%10s%10s%10s" % ("pen", "20", "100"))
print("%10s%10s%10s" % ("note", "5", "95"))
print("%10s%10s%10s" % ("eraser", "110", "97"))

tip >> 서식변수들 사이에 공백 넣으면 안 됨. 공백 넣었더니 계속 error.




JONGOL 105 : 출력 - 형성평가5


  
print("%15s%15s%15s" % ("Seoul","10,312,545","+91,375"))
print("%15s%15s%15s" % ("Pusan","3,567,910","+5,868"))
print("%15s%15s%15s" % ("Incheon","2,758,296","+64,888"))
print("%15s%15s%15s" % ("Daegu","2,511,676","+17,230"))
print("%15s%15s%15s" % ("Gwangju","1,454,636","+29,774"))





JONGOL 513 : 입력 - 자가진단5


  
yd = 91.44
inch = 2.54
print(" 2.1yd = %5.1fcm" % (2.1*yd))
print("10.5in = %5.1fcm" % (10.5*inch))








JONGOL 515 : 입력 - 자가진단7


  a, b = input().split()
a = int(a)
b = int(b)

print(a,"*",b,"=",(a*b))
print(a,"/",b,"=",int(a/b))








JONGOL 516 : 입력 - 자가진단8


  a = float(input())
b = float(input())
c = input()

print("%.2f" % (a))
print("%.2f" % (b))
print("%c" % (c))
  a = float(input())
b = float(input())
c = input()

print("{0:0.2f}".format(a))
print("{0:0.2f}".format(b))
print("%s" % (c))






JONGOL 108 : 입력 - 형성평가3

  a = 50
b = 100.12
print("%s * %d = %.0f" % (b, a, (float(b)*a)))





JONGOL 109 : 입력 - 형성평가4

  a = 50
b = 100.12
print("%s * %d = %.0f" % (b, a, (float(b)*a)))





JONGOL 110 : 입력 - 형성평가5

  
yard = input("yard? ")
print("%.1fyard = %.1fcm" % (float(yard), float(yard)*91.44))