3.Python conditional judgment (if else elif)

Source: Internet
Author: User

#判断
If condition:
Content One
Content II
else: if the meaning
Content Three
The content four examples are as follows:
Name = Raw_input (' Please enter user name: ')
PWD = raw_input (' Please enter password: ')
If name = = "ABC" and PWD = = "123qwe":
Print (' Login successful ')
Else
Print (' Login failed ')

Basic CONDITION Statement: Example of multiple condition judgments:
INP = Raw_input (">>>>")
If InP = = "1":
Print ("111")
Elif INP = = "2":
Print ("222")
Elif INP = = "3":
Print ("333")
Else
Print ("...")

Summary: If Else
If condition:
code block
Else
code block
2 If Condition:
code block
Elif Conditions:
code block
Else
code block
3 conditions
True False
1 > 2 n1 > N2 N1 = = N2
name = = "ABC" or name = = "ACC"
Name! = "ABC"
name = = "ABC" and PWD = = "123"

3.Python conditional judgment (if else elif)

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.