Python Next day homework

Source: Internet
Author: User

1: Write A For loop that iterates through each character with an index
msg= ' Hello Egon 666 '

2: Write a while loop and use the index to iterate through each character
msg= ' Hello Egon 666 '

3:
msg= ' Hello Alex ' in the replacement of Alex into SB

4:
msg= '/etc/a.txt|365|get '
Cut out the file name, file size, and operation method of the character

5. Write a while loop that requires the user to enter a command, and if the command is empty, continue typing

6. Write a while loop, let the user enter the user name and password, if the user is empty or number, re-enter

7. Write the while loop, let the user enter the content, judge the input to start with Alex, then add the string _SB end

8.
1. The two-layer while loop, the outer while loop, lets the user enter a user name, password, work for several months, a monthly salary (integer), a user name or password is empty, or the number of months of work is not an integer, or
The monthly salary is not an integer, re-enter
2. Successful authentication, go to the next layer while loop, Print command prompt, query the total salary, query user identity (if the user name is Alex Print Super User, if the user name is Yuanhao or Wupeiqi
Print the normal user, the rest of the print unkown user), Exit function
3. Require user input to exit, exit all loops (using tag)


The results are as follows:
User:egon
Password:123
Work_mons:12
salary:10000

1 Total Salary Enquiry
2 Querying user identities
3 Sign Out

>>: 1
Total salary is: 120000.0

1 Total Salary Enquiry
2 Querying user identities
3 Sign Out

>>: 2
Unkown User

1 Total Salary Enquiry
2 Querying user identities
3 Sign Out

>>: 3

Python Next day homework

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.