From 97ae235f0beba02497c00939ff48954b3bd972c2 Mon Sep 17 00:00:00 2001 From: Matteo Murat Date: Wed, 23 Sep 2020 14:15:05 +0200 Subject: [PATCH 01/10] Matteo Murat test --- .DS_Store | Bin 0 -> 6148 bytes Submissions/.DS_Store | Bin 0 -> 6148 bytes Submissions/Matteo_Murat/Conditionals.py | 37 +++++++++++++++++++++++ Submissions/Matteo_Murat/my_city.py | 26 ++++++++++++++++ 4 files changed, 63 insertions(+) create mode 100644 .DS_Store create mode 100644 Submissions/.DS_Store create mode 100644 Submissions/Matteo_Murat/Conditionals.py create mode 100644 Submissions/Matteo_Murat/my_city.py diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..655f96ff2639cf22df52ea318a56101a882ab1ec GIT binary patch literal 6148 zcmeHK%}N6?5T3ME(-yG@L65n3>!DJAPQp_4;7wT3gNp9bVi)R0x?78`m3<9;BcH(6 zaVAMCrS>FYT8<-Wj90+QtfNB zZ^RSuI(%arR1|VWrJ9Mx-()=FpU;t<5kkn`IN1=QC4^8=!de5(D?pG`ujAu#C!a(ThgM^z9%jFJf;W8k0TSQGApRCxh0?uF1A*qwDo3pdp2vR)%A^U-_I^@Zl`y% zU%ws85V^)4C&J0 z*FG-rSUGg*Li*xE`kAG#P^6t5<7*o(WZ;lnW`G%Z$pF=UkQTlFdyDIT8^jGWzzqDK z49I#v?Dw!Y|F+KUlHOVkJ%f@^T;=dN1%`c!5lc_;8q^B>nhapzv2q9xg#QRw8n|Hw H-jsnywjf=4 literal 0 HcmV?d00001 diff --git a/Submissions/Matteo_Murat/Conditionals.py b/Submissions/Matteo_Murat/Conditionals.py new file mode 100644 index 0000000..aaf8ca1 --- /dev/null +++ b/Submissions/Matteo_Murat/Conditionals.py @@ -0,0 +1,37 @@ +# encoding: utf-8 + +################################################## +# Author: Matteo Murat +# Copyright: Copyright 2020, IAAC +# Credits: [Institute for Advanced Architecture of Catalonia - IAAC, Advanced Architecture group] +# License: Apache License Version 2.0 +# Version: 1.0.0 +# Maintainer: Matteo Murat +# Email: matteo.murat@students.iaac.net +# Status: development +################################################## + +desidered_distance = 4 +distance_1 = 5 +distance_2 = 10 +current_distance = 2 + +print('the current distance is: ') +print(current_distance) + +if current_distance >= distance_2: + print('so the robotic arm will move faster') +elif current_distance > distance_1: + print('so the robotic arm will move at the same speed') +elif desidered_distance <= current_distance <= distance_1: + print('so the robotic arm will move slower') +elif current_distance <= desidered_distance: + print('so the robotic arm will stop') + +move = 3 +if current_distance < move: + distance_to_move = 0.5 * desidered_distance - current_distance + print('the distance to move is:') + print(distance_to_move) + + diff --git a/Submissions/Matteo_Murat/my_city.py b/Submissions/Matteo_Murat/my_city.py new file mode 100644 index 0000000..1daae8c --- /dev/null +++ b/Submissions/Matteo_Murat/my_city.py @@ -0,0 +1,26 @@ +# encoding: utf-8 + +################################################## +# Author: Matteo Murat +# Copyright: Copyright 2020, IAAC +# Credits: [Institute for Advanced Architecture of Catalonia - IAAC, Advanced Architecture group] +# License: Apache License Version 2.0 +# Version: 1.0.0 +# Maintainer: Matteo Murat +# Email: matteo.murat@students.iaac.net +# Status: development +################################################## + +# End of header section + + +city_name = 'Rome' +city_area = 12685 +city_population = 2873000 +city_density = city_population/city_area + +print('Population Density') +print(city_density) + +# or you can write it in this way +print('Population Density:'+ str(city_density) + ' inhabitants per km2') \ No newline at end of file From c027fff73b4151159f73d6b8203da11cc233f7ae Mon Sep 17 00:00:00 2001 From: Matteo Murat Date: Wed, 23 Sep 2020 21:56:03 +0200 Subject: [PATCH 02/10] Robotic arm exercise --- .DS_Store | Bin 6148 -> 6148 bytes .idea/misc.xml | 2 +- .idea/workspace.xml | 152 ++++++++++++++++-- Part1-Basics/i_for_loops.py | 11 +- .../{Conditionals.py => Robotic_arm.py} | 15 +- 5 files changed, 158 insertions(+), 22 deletions(-) rename Submissions/Matteo_Murat/{Conditionals.py => Robotic_arm.py} (77%) diff --git a/.DS_Store b/.DS_Store index 655f96ff2639cf22df52ea318a56101a882ab1ec..154f8a9f0405dbefe3f3aca9fe081a341917ad12 100644 GIT binary patch delta 315 zcmZoMXfc=|#>B!ku~2NHo}wrV0|Nsi1A_nqLn=dYQh9MfQcix-W<}=Z%=I8CHilw` z9EMDW6l7_j_}8R@oXp}91A`lkOw25-Z0sDIT-==8eB7L|!5R7G!6k_$rNvH(MezbM z!I>$kNr^?_nJFb1A*p$;IjLo-dHzK{i6yB;(ICYk`T03O1rT;(QdnkcdAxv#^W=Ia z9Wk(AKw?P-PyvUsL&5=|-3$zq*D@*ia!9JX1;v#%_05{SWa+ZyhYo|K7#M-R0RurO z4Wo_#87ST<3ogpb$B)qu~2NHo}wrd0|Nsi1A_nqLncEp5N0yuGvsY7T+TSzK!jzp4eM#9 kjSafYo7p+|Ie?lr3vzsCp3E=e$N|&_(#NtnLSzjy02<>G761SM diff --git a/.idea/misc.xml b/.idea/misc.xml index 665eda6..8e5c8e5 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,4 +1,4 @@ - + \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 31ba842..7d3a734 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -40,6 +40,101 @@ + + + + + + + + + + + + + + + + + + + + + + + $USER_HOME$/.subversion @@ -123,22 +218,42 @@ - - + + + - - + + + - - + + + - - + + + + + + + + + + + + + + + + + + + @@ -151,17 +266,30 @@ - - + + + - - + + + + + + + + file://$PROJECT_DIR$/Part1-Basics/i_for_loops.py + 69 + + + + \ No newline at end of file diff --git a/Part1-Basics/i_for_loops.py b/Part1-Basics/i_for_loops.py index b239684..2df2ed1 100644 --- a/Part1-Basics/i_for_loops.py +++ b/Part1-Basics/i_for_loops.py @@ -24,7 +24,9 @@ print('Lets print a series of numbers') -for i in range(10): +range_var = range (10) + +for i in range(3): print(i) print('................................') @@ -49,7 +51,7 @@ print('................................') print('You can also create some shapes: ') text = '' -character = '@' +character = '' for i in range(1, 10): text += character print(text) @@ -57,7 +59,7 @@ print('................................') print('Nested loops are quite useful. Here an example') for i in range(1, 10): - text = '' + text = '_' for j in range(0, i): text += str(i) @@ -65,7 +67,7 @@ # Now combined with conditionals -reference_number = 3 +reference_number = 9 text = ' can be divided into ' print('................................') print('This are numbers which can be divided into ' + str(reference_number)) @@ -77,3 +79,4 @@ # Try to print prime numbers smaller than 100 + diff --git a/Submissions/Matteo_Murat/Conditionals.py b/Submissions/Matteo_Murat/Robotic_arm.py similarity index 77% rename from Submissions/Matteo_Murat/Conditionals.py rename to Submissions/Matteo_Murat/Robotic_arm.py index aaf8ca1..bdbfcbd 100644 --- a/Submissions/Matteo_Murat/Conditionals.py +++ b/Submissions/Matteo_Murat/Robotic_arm.py @@ -11,6 +11,8 @@ # Status: development ################################################## +# End of header section + desidered_distance = 4 distance_1 = 5 distance_2 = 10 @@ -21,17 +23,20 @@ if current_distance >= distance_2: print('so the robotic arm will move faster') + print('move 3 forward') elif current_distance > distance_1: print('so the robotic arm will move at the same speed') + print('move 3 forward') elif desidered_distance <= current_distance <= distance_1: print('so the robotic arm will move slower') + if current_distance < 3: + distance_to_move = (current_distance-desidered_distance) / 2 + print('the distance to move is:' + distance_to_move) + print(distance_to_move) elif current_distance <= desidered_distance: print('so the robotic arm will stop') -move = 3 -if current_distance < move: - distance_to_move = 0.5 * desidered_distance - current_distance - print('the distance to move is:') - print(distance_to_move) + + From 4c1f875e4e5be9692edc0c0a1dacb4bb061c07bb Mon Sep 17 00:00:00 2001 From: Matteo Murat Date: Wed, 23 Sep 2020 22:00:37 +0200 Subject: [PATCH 03/10] update --- .idea/workspace.xml | 36 ++++++++++++++++--------- Submissions/Matteo_Murat/Robotic_arm.py | 2 +- 2 files changed, 24 insertions(+), 14 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 7d3a734..5555a3e 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -15,8 +15,18 @@ + + + + + - + + + + + @@ -218,25 +228,25 @@ - + - + - + - + - + - + - + - + @@ -266,15 +276,15 @@ - + - + - + - + diff --git a/Submissions/Matteo_Murat/Robotic_arm.py b/Submissions/Matteo_Murat/Robotic_arm.py index bdbfcbd..85d4c7a 100644 --- a/Submissions/Matteo_Murat/Robotic_arm.py +++ b/Submissions/Matteo_Murat/Robotic_arm.py @@ -16,7 +16,7 @@ desidered_distance = 4 distance_1 = 5 distance_2 = 10 -current_distance = 2 +current_distance = 2 #you chose the number print('the current distance is: ') print(current_distance) From c394d5c7564f8e350be9c553bddf17f2926a8270 Mon Sep 17 00:00:00 2001 From: Matteo Murat Date: Thu, 24 Sep 2020 11:01:36 +0200 Subject: [PATCH 04/10] Submissions organised as an individual folder --- .idea/workspace.xml | 26 ++++++++++++------------- Submissions/Matteo_Murat/Robotic_arm.py | 4 ++-- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 5555a3e..2777b9d 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -29,7 +29,7 @@ - + - + + + + + + + + + + @@ -50,8 +63,8 @@ - - + + - + - + - + + + + - + + + - - + @@ -198,7 +233,14 @@ @@ -228,42 +270,50 @@ - - + + - + + - - + + - + + - - + + - + + - - + + - + + - - + + - - - + + + + - - - + + + + - - - + + + + - + + @@ -276,14 +326,15 @@ - + - + - - + + + @@ -295,9 +346,29 @@ - file://$PROJECT_DIR$/Part1-Basics/i_for_loops.py - 69 - + + file://$PROJECT_DIR$/Part2-DataTypes/b_list.py + 39 + + + file://$PROJECT_DIR$/Submissions/Matteo_Murat/my_list.py + 8 + + + file://$PROJECT_DIR$/Part2-DataTypes/c_dictionaries.py + 29 + + + file://$PROJECT_DIR$/Part2-DataTypes/d_tuples.py + 24 + diff --git a/Part2-DataTypes/b_list.py b/Part2-DataTypes/b_list.py index 3331d75..bb8f386 100644 --- a/Part2-DataTypes/b_list.py +++ b/Part2-DataTypes/b_list.py @@ -34,7 +34,7 @@ print(my_list, '\n') print("use len() to count the items in a list") -len_list = len(my_list) +len_list = len(my_list) #I can use this var to compare print(len_list, '\n') print("indexing or slicing in a list") diff --git a/Submissions/Matteo_Murat/Prime_numbers.py b/Submissions/Matteo_Murat/Prime_numbers.py new file mode 100644 index 0000000..aef3e92 --- /dev/null +++ b/Submissions/Matteo_Murat/Prime_numbers.py @@ -0,0 +1,11 @@ +#reference_number = 9 +text = ' is a prime number ' +print('................................') +#print('This are numbers which can be divided into ' + str(reference_number)) +for i in range(1, 100): + first = i / i + second = i/1 + # print('Residual value of dividing ' + str(i) + ' / ' + str(reference_number) + ' = ' + str(residual)) + if first == 1: + if second == i: + print(str(i) + text) #+ str(reference_number)) \ No newline at end of file diff --git a/Submissions/Matteo_Murat/my_dict.py b/Submissions/Matteo_Murat/my_dict.py new file mode 100644 index 0000000..f07b40a --- /dev/null +++ b/Submissions/Matteo_Murat/my_dict.py @@ -0,0 +1,17 @@ +city = {'name':'Turin','population':6500000} + +city_population = {'Turin': 6500000, 'Lecce': 15000, 'Bologna':5500000, 'Oporto':3000000, 'Madrid':6000000, 'Barcelona':300000 } +print(city) + +cities = {'names': ['Turin', 'Lecce', 'Bologna','Oporto','Madrid', 'Barcelona'], 'population':[6500000, 15000, 5500000, 3000000, 6000000, 300000]} + + +names = ['Turin', 'Lecce', 'Bologna','Oporto','Madrid', 'Barcelona'] + +population = [6500000, 15000, 5500000, 3000000, 6000000, 300000,] + +cities = [names, population] +number = len (names) + +for i in range (number): + dict_cities[] \ No newline at end of file diff --git a/Submissions/Matteo_Murat/my_list.py b/Submissions/Matteo_Murat/my_list.py new file mode 100644 index 0000000..2366d82 --- /dev/null +++ b/Submissions/Matteo_Murat/my_list.py @@ -0,0 +1,28 @@ + + +names = ['Turin', 'Lecce', 'Bologna','Oporto','Madrid', 'Barcelona'] + +population = [6500000, 15000, 5500000, 3000000, 6000000, 300000,] + +cities = [names, population] + +number_of_cities = len(names) +print(number_of_cities) + +#----------------------------- +#for i in range (number_of_cities): #to have names of cities one under the other +# print (cities[i]) + +#if number_of_cities >= 3: +# print(cities) +#else: +# print(str('you have '), number_of_cities, str('cities')) +#---------------------------- + +print(cities) +print(cities[0][4]) + +print('the city of ', cities[0][0], 'has ', cities [1][0], 'inhabitants') + +for i in range(number_of_cities): + print(cities[0][i], 'has a population of', cities [1][i]) \ No newline at end of file From fff68783c5fcc2851707793928115912d26793c0 Mon Sep 17 00:00:00 2001 From: Matteo Murat Date: Fri, 25 Sep 2020 11:16:04 +0200 Subject: [PATCH 07/10] Submissions organised as an individual folder --- .idea/workspace.xml | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index ce0b934..e36666e 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -29,13 +29,7 @@ - - - - - - - + @@ -326,15 +327,16 @@ - - + + + - + - + From 73c0b09b1b9cf2e98c7cb5a0862fcf093c743328 Mon Sep 17 00:00:00 2001 From: Matteo Murat Date: Fri, 25 Sep 2020 11:27:55 +0200 Subject: [PATCH 08/10] trying to understand GitHub --- .DS_Store | Bin 6148 -> 6148 bytes .idea/workspace.xml | 26 ++++++++++++++++++-------- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/.DS_Store b/.DS_Store index 154f8a9f0405dbefe3f3aca9fe081a341917ad12..bb224ea510f74821f2b3c9c57640656494f3f6da 100644 GIT binary patch delta 103 zcmZoMXfc@JFUrQiz`)4BAi%(2#GuRI!jQ;N!jQOGkYhQs4oHfhApj^;1QbM)W(Z-Z lWGG-rWhhQ5PR>cn&(C4l%)?^F#EIZ)uuWv#%+B$b9{|(!7IFXp delta 53 zcmZoMXfc@JFUrEez`)4BAi%(o%21qCUR;orlb^I%kYhPBBg - + + + @@ -263,9 +272,10 @@ - - + + + @@ -327,16 +337,16 @@ - + - + - + - + From 13d82a291e354070f05f7b1a60127560ee4125ff Mon Sep 17 00:00:00 2001 From: Matteo Murat Date: Fri, 25 Sep 2020 11:28:36 +0200 Subject: [PATCH 09/10] test#2 --- .idea/workspace.xml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 6eff788..0cd1f8a 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -29,9 +29,7 @@ - - - +