1

So when searching on google, the only think I found was printing print() functions all in one line. What I want to do is print multiple functions (like the def function1():) type of function.

if choice == "y":
      dice = input("What are the face values of the dice?")
      for c in dice:
        if c == "1":
          dot1()

I want to be able to print a possible dot2(), or dot3() if the choice is 2, or 3 on that same line. Is that possible? Right now dot1(), 2, and 3 looks like:

def dot1():
  print()
  print(" * ")
  print()
  return()


def dot2():
  print("*")
  print()
  print("  *")
  return()


def dot3():
  print("*")
  print(" *")
  print("  *")
  return()

If so please let me know! Also if you would like more code as an example let me know. This is really bugging me haha

Jacob Smith
  • 123
  • 8

2 Answers2

0

Maybe you are trying to print the dot patterns of the dice faces?

def dot_pattern(c):  
    dice_repr = {1: '\n *\n\n',
             2: '*\n\n  *',
             3: '*\n *\n  *',
             4: '* *\n\n* *',
             5: '* *\n *\n* *',
             6: '* *\n* *\n* *'}  
    return dice_repr[c]

for c in range(1, 7):
    print(dot_pattern(c))
    print()

output:

Output

 *



*

  *

*
 *
  *

* *

* *

* *
 *
* *

* *
* *
* *
Reblochon Masque
  • 35,405
  • 10
  • 55
  • 80
0
dice_dict = {
        1: dot1,
        2: dot2,
        3: dot3
}

dice_dict[1]() # loads function dot1.
tcratius
  • 525
  • 6
  • 15