-
Notifications
You must be signed in to change notification settings - Fork 1
/
ej3.py
23 lines (20 loc) · 819 Bytes
/
ej3.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# -*- coding: utf-8 -*-
#Introducir las estrellas y mostrar los hoteles
import json
with open ('hoteles.json') as data_file:
data=json.load(data_file)
estrellas=int(raw_input("Busqueda de hoteles por estrellas: "))
if estrellas>0 and estrellas<6:
for hoteles in data["resources"]:
if hoteles["dc:title"].count("*")==estrellas:
print hoteles["dc:title"]
elif hoteles["dc:title"].count("*")==estrellas:
print hoteles["dc:title"]
elif hoteles["dc:title"].count("*")==estrellas:
print hoteles["dc:title"]
elif hoteles["dc:title"].count("*")==estrellas:
print hoteles["dc:title"]
elif hoteles["dc:title"].count("*")==estrellas:
print hoteles["dc:title"]
else:
print "Error, introduce las estrellas del 1 al 5"