-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path5.0if语句.py
More file actions
37 lines (29 loc) · 860 Bytes
/
Copy path5.0if语句.py
File metadata and controls
37 lines (29 loc) · 860 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
name = "Alice"
if name.lower() == "alice":
print("Hello",name)
else:
print("I do not know you")
print(3 == 3)
print(30 > 40)
requested_toppings = ['mushrooms', 'onions', 'pineapple']
if 'mushrooms' in requested_toppings:
print("done it")
print("onions" in requested_toppings)
banned_users = ['andrew', 'carolina', 'david']
user = 'marie'
if user not in banned_users:
print(user.title() , ", you can post a response if you wish.")
car = 'subaru'
print("Is car == 'subaru'? I predict True.")
print(car == 'subaru')
print("\nIs car == 'audi'? I predict False.")
print(car == 'audi')
users = ['admin', 'alice', 'bob', 'carol', 'dave']
if len(users) == 0:
print("Dont have users")
else:
for user in users:
if user == "admin":
print("Hello",user.title(),"hao are you")
else:
print("Hello",user)