関数と while ループを使用して数値を表す記号を出力できるようにしたい
元:
number = 250
# symbols
C = 100
^ = 50
印刷する必要があります
CC^
1 つの関数を印刷することはできますが、2 つ以上の印刷関数を連結しようとすると、型エラーが発生します。
TypeError: can't multiply sequence by non-int of type 'function'
number = 251;
def numeral_C(number_par):
while number_par >=100:
numeral_C = number_par / 100
print "C"*numeral_C,
number_par = number_par - numeral_C*100
return ""
def numeral_UpArrow(number_par):
while number_par >=50:
numeral_upArrow = number_par / 50
print "^"*numeral_UpArrow, #error
number_par = number_par - numeral_UpArrow*50
return ""
etruscan_C = str(numeral_C(number))
etruscan_UpArrow = str(numeral_UpArrow(number)) #error
print etruscan_C+etruscan_UpArrow
Traceback (most recent call last):
File "/Applications/Wing IDE/WingIDE.app/Contents/MacOS/src/debug/tserver/_sandbox.py", line 15, in
File "/Applications/Wing IDE/WingIDE.app/Contents/MacOS/src/debug/tserver/_sandbox.py", line 11, in numeral_UpArrow
**TypeError: can't multiply sequence by non-int of type 'function'
エラーが発生せずに2つ以上の関数を印刷できる方法はありますか?