I've written a code to take certain strings as an input and formed a list with those inputs and then use conditional statement on the list but the list seems to be bypassing the condition no matter what the input is.
I would love it someone could tell me what mistake I am doing here.
while done == 'n':
if data == 'y':
# Input for databases
data_n = input('How many databases would you like to download? (Max 4 as of now): ')
n = int(data_n)
i = 0
name = ['a']*n
print('Available databases as of now: \n Baltic wave analysis and forecasts (bw) \n Global wave analysis and '
'forecasts (gw) \n Baltic sea physics analysis and forecast (bp) \n Global ocean 1/12\u00b0 physics '
'analysis and forecast (gp)')
for i in range(0, n):
name[i] = input('Enter the name of the database you would like to download: ')
# Input for the location data
while done == 'n':
if 'bw' or 'bp' in name:
print('Max range for longitudes in Baltic sea: 9\u00b0 to 30\u00b0')
print('Max range for latitudes in Baltic sea: 53\u00b0 to 66\u00b0')
longitude_min_b = input('Enter west limit: ')
longitude_max_b = input('Enter east limit: ')
latitude_min_b = input('Enter south limit: ')
latitude_max_b = input('Enter north limit: ')
elif 'gw' or 'gp' in name:
print('Max range for global longitudes: -180\u00b0 to 180\u00b0')
print('Max range for global latitudes: -80\u00b0 to 90\u00b0')
longitude_min_g = input('Enter west limit: ')
longitude_max_g = input('Enter east limit: ')
latitude_min_g = input('Enter south limit: ')
latitude_max_g = input('Enter north limit: ')
else:
print('Not a valid input.')
done = input('Done? (Y/N): ').lower()
This is what happens when I run the code and enter some arbitrary string values.
How many databases would you like to download? (Max 4 as of now): 2
Available databases as of now:
Baltic wave analysis and forecasts (bw)
Global wave analysis and forecasts (gw)
Baltic sea physics analysis and forecast (bp)
Global ocean 1/12° physics analysis and forecast (gp)
Enter the name of the database you would like to download: a
Enter the name of the database you would like to download: c
Max range for longitudes in Baltic sea: 9° to 30°
Max range for latitudes in Baltic sea: 53° to 66°
Enter west limit:
Thanks in advance đ
Aucun commentaire:
Enregistrer un commentaire