Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7807907
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T03:00:02+00:00 2026-06-02T03:00:02+00:00

I want to be able to print symbols that represent numbers using functions and

  • 0

I want to be able to print symbols that represent numbers using functions and while loops

Ex:

number = 250
# symbols 
C = 100
^ = 50

should print

CC^

While printing one function may work, trying to concatenate two or more print functions lead me to the type error:

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'

I wonder, Is there a way I can print two or more functions without getting the error?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T03:00:03+00:00Added an answer on June 2, 2026 at 3:00 am

    As the others state, you have a problem in re-using in an assignment something that is already the same name as a function:

    def numeral_C(number_par):
       while number_par >=100:
          #this numeral_C is already a known function name, now youre reusing it as an int
          numeral_C = number_par / 100
          #you're using print inside a function, not a best practice, but.....
          print "C"*numeral_C,
          #uncomment the below line to see why the loop is unnecessary
          #print '%d = %d - %d' % (number_par - numeral_C*100, number_par, numeral_C*100)
          number_par = number_par - numeral_C*100
       return ""
       #you're printing, rather than returning, making this useless, and you're str()-ing the "" on return
    
    number = 25101;
    etruscan_C = str(numeral_C(number))
    print
    
    def numeral_c(number_par):
       num_c = number_par / 100
       return 'C'*num_c
    
    print numeral_c(number)
    

    As you can see by the comments, a simple rename of your function will cure this, and perhaps even a rename of your variable. But onto what I consider the ‘larger’ problem…

    I feel like your original math makes a needless loop. compare the behavior of your numeral_C with my numeral_c: both result in the same numeral-C, but one is more re-usable (by having the ‘C’ return as a string) and also it lacks a loop and lots of reassignments.

    Realistically, I cannot find a case when the loop will happen a second time, based on your reassignment of number_par to subtract the nearest FLOORED 100-multiple. In other words, much of that logic is useless. You could reasonably accomplish that whole function with:

    'C'*int(number/100)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using LaTeX and BibTeX for an article, and I want to able to
I want to be able to do some profiling to some app using the
I want to be able to print out all of the changes to the
My users want to be able to print a report I've designed in VS
I want to be able to print out a table with x rows and
I want to be able to print the variable of a structure when I
I want to be able to print some config data to stdout from my
I want to be able to print my custom NSManagedObject in the console, to
First experiences with Python here, I want to be able to print out some
As part of a printing class, I want to be able to print long

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.