"> if else process judgment-CLASS-11 (Part 1)-Python Tutorial-php.cn

if else process judgment-CLASS-11 (Part 1)

PHP中文网
Release: 2017-07-04 19:30:03
Original
1190 people have browsed it

if judgment statement

1 if true: 2 print("true") 3 else: 4 print("false")
Copy after login

Guess age

1 # Author:dd 2 age_of_boy = 56 3 age = int(input("age:")) 4 if age == age_of_boy: 5 print("you got it") 6 elif age > age_of_boy: 7 print("you need guess smaller") 8 else: 9 print("you need guess bigger")
Copy after login

Hide and display the entered password

1 import getpass 2 passwd = getpass.getpass("input your password:")
Copy after login
 1 # Author:dd  2 import getpass  3  4  5 _username = "test"  6 _passwd = "111"  7  8 username = input("username:")  9 passwd = getpass.getpass("passwd:") 10 print(username,passwd) 11 12 if _username == username and _passwd == passwd: 13 print("user {name} login success".format(name=username)) 14 else: 15 print("login failed")
Copy after login
 1 # Author:dd  2 import getpass  3  4  5 _username = "test"  6 _passwd = "111"  7  8 username = input("username:")  9 passwd = input("passwd:") 10 11 if _username == username and _passwd == passwd: 12 print("user {name} login success".format(name=username)) 13 else: 14 print("login failed") 15 print("ddd")
Copy after login

The above is the detailed content of if else process judgment-CLASS-11 (Part 1). For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!