Python Foundation--if and while

Source: Internet
Author: User
Tags python script

Encountered a lot of code, unable to find the cause of the problem:
All the characters in the Python script can be displayed to see if there are any special characters.
Text Editor notepad++, display all character views--display symbols-- display spaces and tabs
Found the problem (alignment with a dot dot space, is the same as the previous lines of the alignment of the arrow indicated by the TAB key, is not matched, that is, the alignment of the code, mixed with the TAB key and Space:)



Preferences: languages, replace with spaces (Tab key):



# import Getpass getpass.getpass ("Password:")

' TypeError: ' >= ' not supported between instances of ' str ' and ' int ' character type inconsistent error int conversion data type
Indentationerror:expected an indented block error is code not aligned
Reference https://www.crifan.com/python_syntax_error_indentationerror/comment-page-1/
‘‘‘
Username = "Wangyachao"
Password = "123"

UserName1 =input ("username")
Password1 = input ("password")

If Username==username1 and Password==password1:
Print ("Welcome User{name} Login ...". Format (name=username))
Else
Print ("Invalid username or password")

Old_of_boy = 56
#guess_age =int (Input ("Pesse input Age:") is the correct representation
Count = 0
While count<3:
Count = count + 1 # equivalent to count + = 1
guess_age = Int (input ("please"))
If Guess_age==old_of_boy:
Print ("Yes.") You get It ")
Break
Elif Guess_age>=old_of_boy:
Print ("Think bigger!")
Else
Print ("Think smaller!")

‘‘‘
For I in Range (0,10): #开始 End step Contimue end this loop break end Loop
If i<5:
Print ("Loop", i)
Else
Continue
Print ("hehe -----")
‘‘‘

Python Foundation--if and while

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.