Think Python (second edition) Exercise code

Source: Internet
Author: User

3-2:

Def do_twice (F, S1): F (S1) F (S1) def print_spam (S2):p rint (S2) def print_twice (S3):p rint (S3) Print (S3) def do_four (F1,f2, S4): F1 (F2,S4) F1 (F2,S4) do_twice (Print_twice, ' AAA ') do_four (Do_twice, print_spam, ' spam ')

3-3.1:

#!/usr/bin/env python3#-*-coding:utf-8-*-def push1 ():p rint (' +----', end = ')  # Print is wrapped by default and can be printed at the end of a space change This behavior def push2 ():p rint (' |        ', end = ') def do_twice (f): F () F () def do_four (f): F () F () F () F () def row1 ():d O_twice (PUSH1) Print (' + ') def-row2 ():d o_twice (PUSH2) print (' | ') Row1 () do_four (row2) row1 () do_four (row2) row1 ()

  

Think Python (second edition) Exercise code

Related Article

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.