-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathex3-1.py
More file actions
42 lines (34 loc) · 971 Bytes
/
ex3-1.py
File metadata and controls
42 lines (34 loc) · 971 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
38
39
40
41
42
__author__ = 'Administrator'
import math
# print(dir(math))
# print(help(math.ceil))
print(math.ceil(84.2))
print('-------------------------------------------')
def traffic_report(light):
if light == 'red':
return 'stop'
elif light == 'yellow':
return 'slow'
elif light == 'green':
return 'go'
print(traffic_report('yellow'))
print('-------------------------------------------')
def fruit_color(fruit):
if fruit == 'apple':
return 'red'
elif fruit == 'banana':
return 'yellow'
elif fruit == 'pear':
return 'green'
print(fruit_color('peach'))
print('-------------------------------------------')
def weather_report(temp):
if temp >= 20:
return 'warm enough for ice cream'
elif temp >= 0:
return 'above freezing'
print(weather_report(20))
print(weather_report(10))
print(weather_report(-5))
print(weather_report(30))
print('-------------------------------------------')