1 Replies - 956 Views - Last Post: 06 December 2012 - 02:54 PM Rate Topic: -----

#1 pschmidley  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 06-December 12

Python Math Game

Posted 06 December 2012 - 02:50 PM

Im writing a math game program in Python and I am having some difficulty with some parts of it. I am very new to Python so bear with me.

I have to display a math problem so it looks like this:
4 * * * *
+ 5 * * * * *
---
->9

my code for this part of the program is as follows:

print(ranNum1)
print("+",ranNum2)
print("---")
print("->",answer)

How would I go about displaying the * marks next to the numbers if the number in the problem are random?

Is This A Good Question/Topic? 0
  • +

Replies To: Python Math Game

#2 jon.kiparsky  Icon User is online

  • Pancakes!
  • member icon


Reputation: 7744
  • View blog
  • Posts: 13,089
  • Joined: 19-March 11

Re: Python Math Game

Posted 06 December 2012 - 02:54 PM

Go into your interpreter and type
>>> n = 5
>>> '*' * n


Does that answer your question?
Was This Post Helpful? 1
  • +
  • -

Page 1 of 1