Re: [Maya-Python] This simple code is giving me a illogical result... Why?

22 views
Skip to first unread message
Message has been deleted

Ian Jones

unread,
Sep 16, 2017, 1:55:35 AM9/16/17
to Python Programming for Autodesk Maya

Your redeclaring the function printThis twice. Name thrm printA and printB. As your currently calling the second one twice.

Ian


On Fri, Sep 15, 2017, 10:47 PM jettam <justin...@gmail.com> wrote:
From this function I m expecting this result:
printStack(2,3)
AAA number: 1
AAA number: 2
BBB number: 1
BBB number: 2
BBB number: 3

But instead I am getting this result!? Why isnt it giving me my expected result. 
printStack(2,3)
BBB number: 1
BBB number: 2
BBB number: 3
BBB number: 1
BBB number: 2
BBB number: 3

def printStack(numTimes_A=None,numTimes_B=None,):
   
''' print AAA x times '''
   
def printThis():
       
for x in range (numTimes_A):
           
int = (x+1)
           
print "AAA number: " + str(int)        
       
   
''' print BBB x times '''    
   
def printThis():
       
for i in range (numTimes_B):
           
int = (i+1)
           
print "BBB number: " + str(int)
               
   
if numTimes_A >= 1:
        printThis
()

   
if numTimes_B >= 1:
        printThis
()
       

printStack
(2,3)

--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/7366c07c-104f-4a8e-b0a9-38533d86b60e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
Message has been deleted
0 new messages