728x90
print("Hello")
print("Hello"[0])
# result H
print("Hello"[4])
# result O
print("123"+"345")
# result 123345
#숫자 에서 '_' 무시한다
print(123_456_789)
# result 123_456_789
#Float
#3.14
#Boolean
True
False
num_char=len(input("what is your name?"))
print(type(num_char))
print("Your name has "+str(num_char)+" characters.")
two_digit_number=input('Type a two digit number')
sum=int(two_digit_number[0])+int(two_digit_number[1])
print(sum)
Quiz
print('Welcome to the tip Calculator')
price=input('What was the total bill? $')
percentage=input('what percentage tip would you like to give? 10,12 or 15?')
person=input('how many people to split the bill?')
tipprice=float(price)*(int(percentage)/100)
totalprice=float(price)+tipprice
Eachprice=round((totalprice)/int(person),2)
print('Each person should pay : $',str(Eachprice))
Quiz Result
Welcome to the tip Calculator
What was the total bill? $124.56
what percentage tip would you like to give? 10,12 or 15?12
how many people to split the bill?7
19.93
Each person should pay : $ 19.93
'DEV > python' 카테고리의 다른 글
kafka dump log 확인 (0) | 2022.08.02 |
---|---|
udemy python 부트캠프 Day-1 (0) | 2022.01.30 |