-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconditional1.py
50 lines (40 loc) · 958 Bytes
/
conditional1.py
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
43
44
45
46
47
48
49
50
""" Learning about conditionals
Pay attention to the COLON after the condition
Note else is different from elif
"""
def positivo(x):
if x > 0:
print(f'{x} é positivo')
elif x < 0:
print(f'{x} é negativo')
else:
print('é nulo')
def determine_input(x):
if type(x) == str:
print('you entered a string')
t_str(x)
else:
print('you probably entered a number')
t_valor(x)
def t_valor(x):
if x > 0:
print('x is positive')
elif x == 0:
print('x is zero')
else:
print('x is negative')
def t_str(x):
if x in 'aeiou':
print('x is a vowel')
elif x == 'z':
print('x is z')
elif x in 'AEIOU':
print('x is a capital vowel')
else:
print("I don't know what you entered")
if __name__ == '__main__':
# a = positivo(-10)
y = 20
determine_input(y)
y = 'o'
determine_input(y)