francesca mangialardo

Results 14 comments of francesca mangialardo

``` def test_my_enumerate(input_list, expected): return my_enumerate(input_list) == expected def my_enumerate(input_list): enumerate_list = list() for i in range(len(input_list)): enumerate_list.append(i) enumerate_list.append(input_list[i]) return enumerate_list list1 = ["Vettel", "Hamilton", "Bottas"] list2 = ["Rossi", "Marquez",...

I came up with two different solutions (they work with any given input): the first makes the assumption of having a blank cell at the starting position pointed by the...

```def test_my_reversed(input_list, expected): return my_reversed(input_list) == expected def my_reversed(input_list): reversed_list = [] for i in range(len(input_list)): pos_wanted = len(input_list) - i - 1 item_wanted = input_list[pos_wanted] reversed_list.append(item_wanted) return reversed_list l1...

``` def test_fib(n, expected): return fib(n) == expected def fib(n): if n

``` from networkx import Graph tim_graph = Graph() tim_graph.add_node("Tim Berners-Lee") tim_graph.add_node("Christian Bizer") tim_graph.add_node("Tom Heath") tim_graph.add_node("Sören Auer") tim_graph.add_node("Lalana Kagal") tim_graph.add_node("James A. Hendler") tim_graph.add_edge("Tim Berners-Lee", "Christian Bizer", weight=17) tim_graph.add_edge("Tim Berners-Lee", "Tom Heath",...

``` def test_my_alg(n, e, expected): return my_alg(n, e) == expected def my_alg(n, e): if e == 0: output = 1 else: output = n * my_alg(n, e - 1) return...

``` from networkx import MultiDiGraph actor_movie_graph = MultiDiGraph() # adding actors actor_movie_graph.add_node("Brad Pitt") actor_movie_graph.add_node("Eva Green") actor_movie_graph.add_node("George Clooney") actor_movie_graph.add_node("Catherine Zeta-Jones") actor_movie_graph.add_node("Johnny Depp") actor_movie_graph.add_node("Helena Bonham Carter ") # adding movies actor_movie_graph.add_node("Ocean's Twelve")...

``` def test_my_range(stop_number, expected): return my_range(stop_number) == expected def my_range(stop_number): stop_number = stop_number - 1 range_list = [] while stop_number >= 0: range_list.append(stop_number) stop_number = stop_number -1 return list(reversed(range_list)) stop_number...

Following the flowchart in Fig. 4 I wrote a Python algorithm to find the result: ``` word1 = "Peroni" word2 = "HTML" bibentry = "Peroni, S., Osborne, F., Di Iorio,...

![algorithms3a](https://user-images.githubusercontent.com/44606486/48505428-56b7ac80-e847-11e8-91c2-e3b466034696.png) ![algorithms3b](https://user-images.githubusercontent.com/44606486/48505907-74394600-e848-11e8-8d9b-6a0516fc4194.png) I'm not sure about the graphical representation of recursion in the second flowchart! EDIT: added the ending terminals