不好意思打擾大家了!
我有一個練習題的問題請教, 在day-2-1-exercise-1中, 我自行寫的內容如下:
two_digit_number = input("Type a two digit number: ")
a = int(two_digit_number[0])
b = int(two_digit_number[1])
print(two_digit_number[0] + two_digit_number[1])
print(type(two_digit_number))
print(a + b)
我將此貼在replit.com中, 有人回覆我如下:
u had already assigned the values to a variables so why didn’t u use the variables inside the print function?
我修改後內容如下, 想請教各位先進, 是否有更精簡的答案, 因我參加此課程前, 對電腦程式完全沒有慨念的, 謝謝組員.
two_digit_number = input("Type a two digit number: ")
a = int(two_digit_number[0])
b = int(two_digit_number[1])
input(type(two_digit_number))
print(a + b)