-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkata4.py
61 lines (37 loc) · 1.41 KB
/
kata4.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
54
55
56
57
58
59
60
61
# EJERCICIO 1 TRANSFORMAR CADENAS
text = """Interesting facts about the Moon. The Moon is Earth's only satellite. There are several interesting facts about the Moon and how it affects life here on Earth. On average, the Moon moves 4cm away from the Earth every year. This yearly drift is not significant enough to cause immediate effects on Earth. The highe The highest daylight temperature of the Moon is 127 C."""
divisiontext = text.split(". ")
divisiontext
PalabrasC = ["average", "temperature", "distance"]
for texto in divisiontext:
for PalabrasC in PalabrasC:
if PalabrasC in texto:
print(texto)
break
print("-"*60)
for texto in divisiontext:
for PalabrasC in PalabrasC:
if PalabrasC in texto:
print(texto.replace(' C', ' Celsius'))
break
print("-"*60)
# EJERCICIO 2 FORMATEANDO CADENAS
# Datos con los que vas a trabajar
gravity = 0.00162 #En km
planillaluna= """Name = "Moon"
Gravity = 0.00162
Planet = "Earth" """
titulo = "Gravedad en la tierra y en la luna"
print(titulo.title())
print("-"*60)
print(planillaluna)
print('\n')
gravedad = gravity*1000
print("La gravedad en metros es: ", gravedad)
print("-"*60)
gravity = 0.00143
nuevaplanilla= """Name = "Ganimedes"
Gravity = 0.00143
Planet = "Marte" """
print(nuevaplanilla)
print("La gravedad en metros es:", gravity*1000)