diff --git a/conditions.py b/conditions.py new file mode 100644 index 0000000..e69de29 diff --git a/javakata.java b/javakata.java new file mode 100644 index 0000000..ee2af5a --- /dev/null +++ b/javakata.java @@ -0,0 +1,12 @@ +public class SquareDigit { + + public int squareDigits(int n) { + // separar cada dígito de n + List listn = new List(); + for (x = 0; x < n.length; x++){ + listn.add(x); + } + // recorrer listn para comprobar cuantos dígitos tiene + } + +} \ No newline at end of file diff --git a/lists.py b/lists.py index 563084b..aa03a40 100644 --- a/lists.py +++ b/lists.py @@ -1,18 +1,18 @@ -# x = object() -# y = object() +x = object() +y = object() -# x_list = [x] * 10 -# y_list = [y] * 10 -# big_list = [] +x_list = [x] * 10 +y_list = [y] * 10 +big_list = [] -# big_list = x_list + y_list +big_list = x_list + y_list -# print("x_list contains %d objects" % len(x_list)) -# print("y_list contains %d objects" % len(y_list)) -# print("big_list contains %d objects" % len(big_list)) +print("x_list contains %d objects" % len(x_list)) +print("y_list contains %d objects" % len(y_list)) +print("big_list contains %d objects" % len(big_list)) -# # List().count(x) cuenta el número de items que hay con el valor x en la lista -# if x_list.count(x) == 10 and y_list.count(y) == 10: -# print("Almost there...") -# if big_list.count(x) == 10 and big_list.count(y) == 10: -# print("Great!") \ No newline at end of file +# List().count(x) cuenta el número de items que hay con el valor x en la lista +if x_list.count(x) == 10 and y_list.count(y) == 10: + print("Almost there...") +if big_list.count(x) == 10 and big_list.count(y) == 10: + print("Great!") \ No newline at end of file diff --git a/string_operators.py b/string_operators.py index b11ff5a..4925527 100644 --- a/string_operators.py +++ b/string_operators.py @@ -1,11 +1,11 @@ -# nombre = 'Jaume' -# altura = 1.73 -# print('Nombre: %s, altura: %.2f' % (nombre, altura)) - -# data = ('Jaume', 'Ordinas', 100.77) -# format_string = 'Hello %s %s. Your current balance is $%s.' -# print(format_string % data) -# ## print(format_string, data[0], data[1] + '. Your current height is %.2fm' % data[2]) +nombre = 'Jaume' +altura = 1.73 +print('Nombre: %s, altura: %.2f' % (nombre, altura)) + +data = ('Jaume', 'Ordinas', 100.77) +format_string = 'Hello %s %s. Your current balance is $%s.' +print(format_string % data) +## print(format_string, data[0], data[1] + '. Your current height is %.2fm' % data[2]) text = "abcdefghi" # text[start:stop:step]