Python Programming Quick Start 6th Chapter Practical Project Reference Answer

Source: Internet
Author: User

 #!/usr/bin/env python3.52#Coding:utf-83#4#The main purpose of this project is the processing of strings, the simple format of the output5 Tabledata = [['Apples','oranges','Cherries','Banana'],  6 ['Alice','Bob','Carol','David'],  7 ['Dogs','Cats','Moose','Goose']]  8#The required output is as follows:9#Apples Alice Dogs10#Dranges Bob Cats11#Cherries Carol Moose12#Banana David Goose13 14#no output format, output format is all right-aligned15defprinttable (data):Str_data ="'Col_len = [] 18 forRowinchRange (0,len (data[0)):19 forColinchRange (0,len (data)):20Col_len.append (len (data[col][row) )Max_col_len =Max (Col_len)22Print("the length of each element of the list is:") 23Print(Col_len)24Print("the maximum value in the list is:", Max_col_len)25 forRowinchRange (0,len (data[0)):26 forAo.inchRange (0,len (data)):27Print(Data[col][row].rjust (Max_col_len), end="') 28Print() 29returnStr_dataF_data =printtable (tabledata)31Print(F_data)

Python Programming Quick Start 6th Chapter Practical Project Reference Answer

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.