私は合計でnoobですので、よろしくお願いします。私は自分のプログラムで整数入力を受け付けることができません。彼らはすべて文字列として出てくる。これを確認するには、現在コメントアウトされているtype()行を追加します。私のプログラムで入力を整数として受け入れるにはどうすればいいですか?ありがとう。数値が入力されていても、Python 3.xの文字列にデフォルトで入力する
あなたはint型に文字列を変換する必要があり# TIP CALCULATOR
def main():
cost = input('Please enter the cost of your meal or service.')
tip_percentage = input('Please enter what percentage of tip you would like to pay.')
#print(type(cost))
#print(type(tip_percentage))
total = tip_percentage * cost + cost
return total
final = main()
print(final)