Python Basic Learning 11 days, homework questions

Source: Internet
Author: User

1. File a.txt content: Each line content is the product name, the price, the number.

Apple 10 3

Tesla 100000 1

MAC 3000 2

Lenovo 30000 3

Chicken 10 3

By code, build it into this data type: [{' name ': ' Apple ', ' price ': ' Amount ': ' 3},{' name ': ' Tesla ', ' price ': 1000000, ' Amount ': 1} ...] and calculate the total price.

2, there are the following documents:

-------

Alex is the old boy Python initiator, creator.

Alex is actually a tranny.

Who says Alex is SB?

You guys are so funny, Alex, you can't hide the temperament of senior cock silk.

----------

Replace all Alex in the file with an uppercase SB.

3. File A1.txt content: Each line content is the product name, the price, the number.
File contents:

Name:apple price:10 Amount:3 year:2012
Name:tesla price:100000 amount:1 year:2013


Through the code, build it into this type of data:
[{' name ': ' Apple ', ' price ': Ten, ' Amount ': 3},
{' name ': ' Tesla ', ' price ': 1000000, ' Amount ': 1} ...]
and calculate the total price.

4, File A2.txt content: Each line content is the product name, the price, the number.

File contents:
Number of department number average age remark
1 Python 30 26 single Dog
2 Linux 26 30 no objects
3 Operations Department 20 24 more girls
Through the code, build it into this type of data:
[{' Ordinal ': ' 1 ', ' Department ':P Ython, ' number ': 30, ' mean age ': 26, ' remark ': ' Single Dog '},
......]
and calculate the total price.

Python Basic Learning 11 days, homework questions

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.