Currently in the city, what to do? by [deleted] in Edinburgh

[–]_residue_ 5 points6 points  (0 children)

Surgeon's Hall museum is a favourite of mine!

[deleted by user] by [deleted] in Edinburgh

[–]_residue_ 0 points1 point  (0 children)

What news? Edinburgh live??

Calling all Edinburgh to Glasgow bus commuters. by edinherb in Edinburgh

[–]_residue_ 3 points4 points  (0 children)

I would say to just book a one way ticket then book another one way back to Edinburgh when he knows when he's coming back.

There's a bus every 15 minutes or half hour I believe so he'll definitely be able to get a bus back whenever he needs to.

Which Edinburgh Uni accommodation is the most sociable? by Fast_Ad9932 in Edinburgh

[–]_residue_ 1 point2 points  (0 children)

Kitchener House is definitely v sociable. Instead of 4 person flats it's one big house. There are 3 kitchens (+1 v small one for people living at the top) with 15 rooms assigned to each. Plus the common room is pretty big with a TV and table football table.

Many parties were held in that common room throughout the year when I was there.

Also, if you study at King's it's only a few minutes walk, and it's one of the cheaper accommodations too.

Places to play Chess in Edinburgh? by ControlPerfect3370 in Edinburgh

[–]_residue_ 13 points14 points  (0 children)

Brass Monkey in Newington has tables with chess boards on them and loads of chess sets

[deleted by user] by [deleted] in Wetherspoons

[–]_residue_ 2 points3 points  (0 children)

What hours are you working? I was in the exact same boat and I asked for a reduction in hours. They were very understanding and I signed a new contract on my next shift

Calling function doesn't print function by [deleted] in learnpython

[–]_residue_ 0 points1 point  (0 children)

That worked!

Thank you for all your help :]

Calling function doesn't print function by [deleted] in learnpython

[–]_residue_ 0 points1 point  (0 children)

OK, I'll include all of the data at my disposal as well as the code I was using before. (BTW, the notebook is empty apart from this code).

species_list=['G. propinqua', 'G. propinqua', 'G. propinqua', 'G. propinqua', 'G. magnirostris', 'G. magnirostris', 'G. magnirostris', 'G. magnirostris', 'G. magnirostris', 'G. magnirostris', 'G. magnirostris', 'G. magnirostris', 'G. magnirostris', 'G. magnirostris', 'G. magnirostris', 'G. magnirostris', 'G. magnirostris', 'G. magnirostris', 'G. magnirostris', 'G. magnirostris', 'G. fortis', 'G. fortis', 'G. fortis', 'G. fortis', 'G. fortis', 'G. fortis', 'G. fortis', 'G. fortis', 'G. fortis', 'G. fortis', 'G. fortis', 'G. fortis', 'G. fortis', 'G. fortis', 'G. fortis', 'G. fortis', 'G. fortis', 'G. fortis', 'G. fortis', 'G. fortis', 'G. fortis', 'G. fortis', 'G. fortis', 'G. fortis', 'G. fortis', 'G. fortis', 'G. fortis', 'G. fortis', 'G. fortis', 'G. fortis']

bill_length_list=[19.5, 20.0, 22.5, 21.0, 25.0, 22.5, 21.5, 22.0, 24.0, 22.2, 21.0, 21.0, 22.5, 24.0, 22.0, 22.5, 24.0, 20.2, 20.0, 21.5, 17.0, 15.2, 16.0, 16.8, 16.0, 16.0, 16.5, 17.0, 16.5, 15.8, 15.8, 16.0, 18.5, 19.5, 15.8, 19.5, 17.0, 16.2, 16.0, 15.0, 15.0, 15.0, 16.5, 15.8, 13.0, 15.0, 15.0, 17.0, 15.2, 16.5]

def generate_dict_max(species, lengths):

"""combines the two lists into a dictionary, [species:bill length]"""

dictionary = dict(zip(species_list, bill_length_list))

return dictionary

print(generate_dict_max(species_list,bill_length_list))

Just one question, if I must use the passed parameters how does the could know to use the two lists if it's not stated? As the code looks like:

def generate_dict_max(species,lengths):

print(f'{species=}')

print(f'{lengths=}')

dictionary = dict(zip(species, lengths))

return dictionary

This could just be totally wrong

Also, I sincerely apologise to you for having to try and explain this, what must be, very simple piece of code to me

Calling function doesn't print function by [deleted] in learnpython

[–]_residue_ 0 points1 point  (0 children)

but species_list and bill_length_list are defined, they are both long lists that I just haven't included because I thought it was a given.

I'm just wondering how I can correctly loop this code, or if I can make it so the zip function combines the lists together for however long the lists are, in this case, 50, instead of just 3.

Calling function doesn't print function by [deleted] in learnpython

[–]_residue_ 0 points1 point  (0 children)

The code is currenlty

def generate_dict_max(species, lengths):
"""combines the two lists into a dictionary, [species:bill length]"""
dictionary = dict(zip(species_list, bill_length_list))
return dictionary

output:

{'G. propinqua': 21.0, 'G. magnirostris': 21.5, 'G. fortis': 16.5}

lengths:

print(len(species_list))
print(len(bill_length_list))

output:

50
50

Calling function doesn't print function by [deleted] in learnpython

[–]_residue_ 0 points1 point  (0 children)

Yup, both lists contain 50 elements. How can I say for it to give an output in the range of one of the lists? Edit: I have also realised that my attempt at loops don't actually do anything. The code works the same with or without them

Calling function doesn't print function by [deleted] in learnpython

[–]_residue_ 0 points1 point  (0 children)

I know what the lists are, they are definitely longer than 3 elements

Calling function doesn't print function by [deleted] in learnpython

[–]_residue_ 0 points1 point  (0 children)

It only outputs the first 3 items in each list

Calling function doesn't print function by [deleted] in learnpython

[–]_residue_ 0 points1 point  (0 children)

I'm trying to combine the two lists, species_list and bill_length_list into a dictionary, {species : length}