Python function Recursive day15

Source: Internet
Author: User

The function calls itself inside itself

The wireless loop will be error-free, so a definite end condition is required

def Calc (n):     Print (n)    calc (n) Calc (10)
def Calc (n):     Print (n)     if int (N/2) = = 0        :return     nreturn calc (int (N/2 )) Calc (10)

Ask an example of a road

person = ['WL','WP','JP','yby','Tyn']Import TimedefAskway (person):Print('-'*60)    ifLen (person) = =0:return 'Nobody even knows .'P= Person.pop (0)#list pops up one at a time    ifp = ='yby':        return '%s said: See you at the next intersection.'%PPrint('hi boy%s, dare to ask where the road'%p)Print('%s replied: "I do not know, I help you ask the"%s "'%(P,person)) Time.sleep (3) Res=Askway (person)returnResres=Askway (person)Print(RES)

Python function Recursive day15

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.