Python day two: if judgment, while loop, for loop, pycharm use, numeric type, and string type

Source: Internet
Author: User
First, the content

Second, the String method

Http://www.cnblogs.com/fyknight/p/7895894.html

Third, practice

1. Write A For loop and use the index to iterate through each character

2. Write a while loop and use the index to iterate through each character

3. Replace ' world ' with Python in msg= ' Hello World '
4, the character's file name, file size, operation method cutting out

msg= '/etc/a.txt|888|get '

5, write a while loop, require the user to enter a command, if the command is empty, continue to enter

6, write while loop, let the user enter the user name and password, if the user is empty or number, then re-enter

7, write while loop, let the user input content, judge the input content to start with dark_knight, then add the string successfully 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 knight or Lisa
Print the normal user, the rest of the print unkown user), Exit function
3. Require user input to exit, exit all loops (using tag)

Python day two: if judgment, while loop, for loop, pycharm use, numeric type, and string type

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.