태지쌤

로봇 & 코딩교육 No.1 크리에이터

파이썬/exercise

8-1. python function - math ceil

태지쌤 2023. 1. 4. 14:19
반응형
def greet():
	print("hi")
	print("hi")
	print("hi")

greet()

def greet_with_name(name):
	print(f"hi {name}")

greet_with_name("TJ")

페인트 면적 구하기

파이썬에서 올림 구할 때 math에서 ceil

#Write your code below this line 👇
import math

def paint_calc(height, width, cover):
	result = math.ceil(height * width / cover)
	print(f"You'll need {result} cans of paint.")





#Write your code above this line 👆
# Define a function called paint_calc() so that the code below works.   

# 🚨 Don't change the code below 👇
test_h = int(input("Height of wall: "))
test_w = int(input("Width of wall: "))
coverage = 5
paint_calc(height=test_h, width=test_w, cover=coverage)
반응형