-
Notifications
You must be signed in to change notification settings - Fork 0
/
second.py
53 lines (47 loc) · 804 Bytes
/
second.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
51
52
53
#identacao condicional
x=0
y=10
if 0 == x:
if y == 10:
print("Yes")
if y > 0: print("Yes")
#Condicional for
for i in range(-1,5):
print("\ni'm ",i)
if i > 2:
print("Bigger then 2")
print("Done wiht i", i)
print("All done\n")
# If Then Else
x=4
if x > 2:
print("Bigger")
else:
print("Smaller")
print("End\n")
#ElIf MultiWAY - a primeira ocorrencia
if x < 2:
print("Small")
elif x < 5:
print("Medium")
elif x < 10:
print("Large")
else:
print("Bigger")
print("End\n")
#Try/except
temp = "5 degrees"
cel = 0
try:
fahr = float(temp)
except:
fahr = 5
cel = (fahr - 32.0) * 5.0 / 9.0
print(cel)
num = input("\nEnter a number: ")
try:
ival= int(num)
except:
ival = -1
if ival > 0 : print ("obrigado")
else: print("Não é um numero")