No tienes acceso a esta clase

¡Continúa aprendiendo! Únete y comienza a potenciar tu carrera

Characters

10/33
Recursos

Aportes 79

Preguntas 2

Ordenar por:

¿Quieres ver más aportes, preguntas y respuestas de la comunidad?

(

//ejercicio 1
let nameCharacters: [Character] = ["J", "o", "s", "é", " ", "M", "i", "g", "u", "e", "l", " ", "\u{1f1f2}"]
let nameString = String(nameCharacters)
print(nameString)
//ejercicio 2
let myNumber = 8
for index in 0...10 {
    print("\(myNumber) * \(index) = \(myNumber * index)")
}

😎

//reto 1
let myNameChars: [Character] = ["J", "u", "a", "n"]
var myNameString = String(myNameChars)
myNameString.append(colombianFlag)

//reto 2
var number = 2
for i in 0...10 {
    print(2*i)
}

`//Declaramos el texto a convertir a arreglo` `var myName = "Jose Eduardo"` `//Declaramos un arreglo vacio` `var myArray = [String]()` `//Easy print para indicar el número de caracteres y la tabla a mostrar` `print("the name \(myName) has \(myName.count) characters, therefore, the multiplying table will be \(myName.count)")` `//Ciclo para agregar cada caracter (incluyendo espacios) al arreglo vacio anteriormente declarado` `for chr in myName{` ` myArray.append(String(chr))` ` //Validación del número de caracteres agregados al arreglo por iteración` ` print(myArray,myArray.count)` `}` `//Separador` `print("*********")` `//Ciclo que muestra la tabla multiplicadora` `for idx in 1...myArray.count{` ` print("\(idx) x \(myArray.count) = \(idx * myArray.count)")` `}` `// ----Short way----` `/*` `Una vez declaramos el string podemos acceder a la propiedad de la variable:` ` ` ` myName.count` `Con esto podemos evitar agregar el paso para pasar todo a un arreglo pero es buena práctica 😜` ` */`
![](https://static.platzi.com/media/user_upload/image-193aa500-c320-4d12-9c34-92f148578076.jpg)
```js //Ejercicio 1 let nameA : [Character] = ["A", "L", "E", "X", "I", "S", "\u{1F1F2}\u{1F1FD}"] var messageName = String(nameA) print(messageName) //Ejercicio 2 let numero = 5 for num in 1...10{ print("Tabla del 5: \(num) * numero = \(num * numero)") } ```
```js // 1: Formar String a partir de Array: let myNameAndNationality : [Character] = ["C", "r", "i", "s", "t", "i", "a", "n", "\u{1F1E8}"] var arrayToString = String(myNameAndNationality) // 2: Elegir un número y crear la tabla de multiplicar mediante ciclo for: var myNumber = 5 for multiplier in 1...10 { // Range... print("\(myNumber) * \(multiplier) es \(myNumber * multiplier)") } ```// 1: Formar String a partir de Array: **let** myNameAndNationality : \[Character] = \["C", "r", "i", "s", "t", "i", "a", "n", "\u{1F1E8}"] **var** arrayToString = String(myNameAndNationality) // 2: Elegir un número y crear la tabla de multiplicar mediante ciclo for: **var** myNumber = 5 **for** multiplier **in** 1...10 { // Range... print("\\(myNumber) \* \\(multiplier) es \\(myNumber \* multiplier)") }

por que hacer una sola tabla si podemos hacer todas 😄

let array : [Int] = [1,2,3,4,5,6,7,8,9,10]

for multiplicando in array {
    print("Tabla de \(multiplicando):")
    for multiplicador in array {
        let resultado = multiplicando * multiplicador
        print("\(multiplicando) x \(multiplicador) = \(resultado)")
    }
    print("\n")
}
let country = "\u{1F1F2}"
var newName :[Character] = ["m","a","r","i","o"]
var strName = String(newName)
strName.append(country)
print(strName)
for i in 1...10 {
    for n in 1...10 {
        print("\(i)x\(n) = \(i*n)")
    }
}

Reto 1
let exclamationMark : Character = "!"
let nameCharacter: [Character] = [“J”, “e”, “s”, “s”, “i”, “c”, “a”]
var nameString = String(nameCharacter)
nameString.append(exclamationMark )

Reto 2
let number = 10
for i in 0…9{
print("(i+1) * (number) = ((i+1) * number)" )
}

//Reto:
//1)
let nombreChar:[Character] = ["L","U","I","S"," "]
var nombreString = String(nombreChar)
nombreString.append(nacionalidad) //Usando la variable previamente creada.

//2)
let multiplicador = 8

for i in 1...10 {
    var resultado = multiplicador * i
    print("\(multiplicador) x \(i) = \(resultado)")
}

ojo que juan no lo explica, pero el append no retorna un valor, por lo que queda en void, y si quieres imprimir con ese append, te retorna un ()

let nameCaracter2 : [Character] = ["R" , "A" , "U" , "L"]
var nameString2 = String(nameCaracter2)
let country = "\u{1F1EA}\u{1F1F8}"

var newName = "Me llamo \(nameString2) y soy de \(country)"
print(newName)

let number = 7
for table in 1...12{
    let res = number * table
    print("\(number) * \(table) = \(res)")
}
// Ejercicio 1
var name: [Character] = ["C","l","a","r","a"]
var imFrom: [Character] = ["s","o","y"," ","d","e"," "]
let flag: Character =  "\u{1F1E6}\u{1F1F7}"

imFrom.append(flag)

var message = "Hola! mi nombre es "
message.append(String(name) + ", ")
message.append(String(imFrom))

print(message)

// Ejercicio 2
let maxRange: Int = 10
let value: Int = 3

for i in 0...maxRange {
    print("\(value) * \(i) = \(i*value)")
}

// Ejercicio 1
var myName: [Character] = ["I", "n", "g", "r", "i", "d"]
myName.append("\u{1F1E8}\u{1F1F4}")

var myNameString = String(myName)
print(myNameString)

// Ejercicio 2
let myNumber = 3
for i in 0...10 {
    print("\(myNumber) * \(i) = \(myNumber * i)")
}

🚀 Mis retos

Reto 1

let myLetters: [Character] = ["E", "d", "u", "a", "r", "d", "o"]
let myFlag: Character = "🇳🇮" // Nicaragua
var myName = String(myLetters)
myName.append(" \(myFlag)")

print(myName) // Eduardo 🇳🇮

Reto 2

let table = 8
for num in 1...12 {
    let result = table * num
    print("\(table) * \(num) = \(result)")
}

let tablaDelSiete = 7
for i in 0…9 {
let count = i+1
let multi = count * tablaDelSiete
print("(tablaDelSiete) * (i+1)" , “= (multi)”)
}

Comparto Otra manera de hacerlo

//Any me sirve para recibir cualquier tipo de dato
func TablaMultiplicar(nume:Any)->String{

  //guard es un tipo de assert que si no se cumple hace lo que esta dentro del bloque
  guard let num=nume as? Int else { // as? Int es una manera de pregunta si el dato es Int, esto devuelve un bool 
    return "No se pudo leer el Numero"
  }
  var cadena = String()
  
  for i in 1...10{
      cadena += "\(num) X \(i) = \(num*i)\n"
    }
  return cadena
}

print(TablaMultiplicar(nume:"dw"))

//reto 1
let miNombre : [Character] = [“M”, “a”, “r”, “c”, “o”]
let bolivianFlag = “\u{1F1E7}\u{1F1F4}“
var msg = “Mi nombre es (String(miNombre)) y soy de (bolivianFlag)”
//reto 2
let tabla = 5
for i in 0…9 {
print(”(i + 1) * (tabla) = ((i + 1) * tabla)”)
}

"Mi nombre es Marco y soy de 🇧🇴"
1 * 5 = 5
2 * 5 = 10
3 * 5 = 15
4 * 5 = 20
5 * 5 = 25
6 * 5 = 30
7 * 5 = 35
8 * 5 = 40
9 * 5 = 45
10 * 5 = 50

// Ejercicio Uno
let stringArray:[Character] = ["B","R","Y","A","N"," ","\u{1F1E8}\u{1F1F4}"]
let nameArray = String(stringArray)
print(nameArray)

// Ejercicio Dos
let num = 8
for i in 0...10{
    print("\(num) x \(i) = \(num * i)")
}

Yo lo solucione de la siguiente manera:

for i in 1...10 {
    for j in 1...10 {
        print("\(i) * \(j) = \(i*j)")
    }
    print()
}

Hice un bucle dentro de otro para saber varias tablas 😄

let tables = 7...8
for i in tables {
    print("Table of \(i)")
    for j in 1...10 {
        print ("    \(i) x \(j) = \(i*j)")
    }
}

let nameChars : [Character] = ["J","A","V","I","E","R"]
var nameString = String(nameChars)
let country = "\u{1F1EA}\u{1F1E8}"

var newName = "Me llamo \(nameString) y soy de \(country)"
print(newName)

let number = 7
for table in 1...12{
    let res = number * table
    print("\(number) * \(table) = \(res)")
}
var myName: [Character] = ["d","e","i","s","y"]
var newName = (String(myName))+flag
print(newName)


var numM = 3
for num in 0...10 {
    print("\(num)*\(numM) = \(numM*num)")
}

![](


let table = 4

for i in 0...9{
        
    let count = i+1
    let multp =  count * table
    print("\(i+1) * \(table) = \(multp)")
}

var nameSeba : [Character] = ["S", "E", "B", "A","S","T", "I", "A", "N"]
var nameSString = String(nameSeba)
nameSeba.append(exclamationMark)
var number = 4
for i in 0...10{
    print(i*4)
}

Reto cumplido! 😎

// Reto 01
let chMyName : [Character] = ["S", "o", "y", " ", "J", "o", "s", "e", " ", "y", " ", "v", "i", "v", "o", " ", "e", "n", " ", "\u{1f1f5}\u{1f1ea}"]
var myName = String(chMyName)
myName.append(exclamationMark)
myName += " 🤩"
print(myName)

// Reto 02
let five = 5
for i in 0..<13 {
    print("\(five) * \(i) = \(five * i)")
}
var multiplo = 3
for i in 1...10 {
    print("3 * \(i) = ", multiplo * i)
}

Lo hice asi, no se si se podra mejorar 😃

let enteros = [1,2,3,4,5,6,7,8,9,10]

for (indice, value) in enteros.enumerated() {
  let i = indice + 1
print("\(value) x \(i) = \(i*value)")
}

let tablaTres = 3

for i in 1…10{
print (“3 x (i)”, i*tablaTres)
}

for i in 1…10{
print(" 3 * (i) = (i*3)" )
}

Reto 2:

let numberToCalculateTables = 8

for i in 1...10 {
    print("\(numberToCalculateTables) * \(i) = \(numberToCalculateTables * i)")
}

Reto 1:

let myDescriptionInChars: [Character] = ["F", "r", "a", "n", " ", "\u{1F1EA}", "\u{1F1F8}"]
print(String(myDescriptionInChars))

Por si se lo preguntaban, si el caracter es un let, y el message es un var, sí lo permite ya que var es mutable.

Reto 1 😁

Reto 2 😁

Mi ejemplo de código para imprimir las tablas de multiplicar.

import Foundation

let mensaje = "Tabla de multiplicar del numero: "
var producto = 0

for num in (1...10){
  print("\n",mensaje,num)
  for mul in (1...10){
    producto = num*mul
    print("",mul,".-",num," X ",mul," = ",producto)
  }
}
let multiplier = 7

print("La siguiente es la Tabla del 7 \n")

for i in 1 ... 10{
    print("\(multiplier) * \(i) = \(multiplier * i)")

La siguiente es la Tabla del 7

7 * 1 = 7
7 * 2 = 14
7 * 3 = 21
7 * 4 = 28
7 * 5 = 35
7 * 6 = 42
7 * 7 = 49
7 * 8 = 56
7 * 9 = 63
7 * 10 = 70

for i in 1...10 {
    let result = i * 3
    print("3 x \(i) = \(result)")
}
// un array con nuestro nombe y el emoji de bandera usando peru
let miNombre : [Character] = ["A","n","d","r","e"]
var mensaje = "Me llamo \(String(miNombre)) y soy de \(peruEmoji)"
mensaje.append(exclamationMark)

// usar numero y tabla de multiplicar
var numero : Int = 37
for i in 1...10{
    print("El elemento numero \(i) de la tabla del 37 es \(i) x \(numero) = \(numero * i)")
}

let number : UInt8 = 7

for i in 0…10 {
print("(number) * (i) = (number * UInt8(i))")
}

var numerosNew = ["1","2","3","4","5","6","7","8","9","10"]

for identiffic in 0..<numerosNew.count{
    for identiffic2 in 0..<numerosNew.count {
       
        print("La multipliccacion del numero \(identiffic2) * \(numerosNew[identiffic]) = \(identiffic2 * (identiffic+1))")
    }
    
}

Primer reto:

var name: [Character] = ["D", "i", "e", "s", "a", "n"]
name.append("\u{1F1E8}\u{1F1FA}")
let completeName = String(name)
print(completeName)

Tabla de multiplicar del 3

let numberToMultiply = 3

for number in 1...10 {
    print("\(numberToMultiply) * \(number) = \(numberToMultiply * number)")
}

retos 😄

// reto 1
let nameCompleteChar: [Character] = ["F","e","l","i","p","e"]
let nameCompleteString = String(nameCompleteChar)
print(nameCompleteString)

// reto 2
let multiplierTable:UInt8 = 5
for index in 1...10 {
    print("\(multiplierTable) x 1 = \(multiplierTable * UInt8(index))")
}

Reto 1

let greetingChars: [Character] = ["S", "o", "y", " ", "H", "e", "r", "n", "a", "n", " ", "d", "e", " "]
var greetingString = String(greetingChars)
greetingString.append(argentinaFlag)

Reto 2

let times_table = 5
for n in 0...10 {
    print("\(times_table) x \(n) = \(times_table * n)")
}

for id in 1…<10 {
print(" 10 x (id) = (id * 10)")
}
print()
for id in 1…<10 {
print(" 9 x (id) = (id * 9)")
}
print()
for id in 1…<10 {
print(“8 x (id) = (id * 8)”)
}
print()
for id in 1…<10 {
print(“7 x (id) = (id * 7)”)
}
print()
for id in 1…<10 {
print(" 6 x (id) = (id * 6)")
}

// Reto 1
let nameWill: [Character] = ["W", "i", "l", "s", "o", "n", " "]
let flagEcuador2 = "\u{1F1EA}" + "\u{1F1E8}"
var nameWString = String(nameWill)
nameWString.append(flagEcuador2)
print(nameWString)

//Reto 2
let number = 6
for i in 0...9 {
    print("\(i+1) * \(number) = \((i+1) * number)" )
}

😃

Es interesante ver como por ejemplo la variable name, es mutable y sin embargo no es posible modificar la propiedad name.count, supongo que es porque sus atributos son tipo “readonly” o algo así.

let signoDeExclamacion: Character = "!"
let uname : [Character] = ["J", "o", "s", "é"]
var sayName = String(uname)
sayName.append(signoDeExclamacion)

for i in 1...10{
    let multi = 5
    print("\(multi) * \(i) = \(i * multi)")
}```

// Reto
let multiplicarTabla = 3
for i in 0…10{
print("(multiplicarTabla) * (i) = (i * multiplicarTabla)")
}

// Challenge 1
var nombreBandera = "Hernan Maza \u{1F1EA}\u{1F1E8}"
print(nombreBandera)
//Challenge 2
var tableMultiplier = 3
for i in 0...10 {
    print("\(tableMultiplier) x \(i) = \(tableMultiplier * i)")
}

Mis respuestas 😃

// Task 1:
var myNameOfChars: [Character] = ["O", "s", "c", "a", "r"]
let myCountry: [Character] = ["\u{1F1F5}", "\u{1F1EA}"]
var myName = String(myNameOfChars)
myName.append(String(myCountry))

// Task 2:
var number: Int16 = 12
var limitTable: Int16 = 12
for i in 1...limitTable {
    print("\(number) x \(i) = \(number*i)")
}
var name: [Character] = ["B","r","a","d","l","e","y"," ","\u{1F1F2}\u{1F1FD}"]
var stringName = String(name)

var number = 2
for i in 1...10 {
    print(i * number)
}
for inx in 0...9 {
    print("\(inx + 1) * 8 = \((inx + 1) * 8)")
}```
<
let nameCharacters : [Character] = ["F", "R", "A", "N", "C", "I", "S", "C", "O"]
let lastNameCharacters : [Character] = ["G", "A", "R", "C", "I", "A"]

var nameString = String (nameCharacters)
var lastNameString = String (lastNameCharacters)

let compundName = nameString + lastNameString + String(CountryFlag)
print(compundName)
compundName.count
print(compundName.count)


var number = 2

for i in 1...10 {
    print( i * number)
}

var number3 = 3

for t in 1..<10 {
    print(t * number3)
}

var number5 = 5

for c in 1..<x5 {
    print(c * number5)
}
>
//Ejercicio 1
//let bandera = "\u{1F1E8}\u{1F1F4}"
let myNameChar: [Character] = ["J", "U", "A", "N", "S", "E", "\u{1F1E8}\u{1F1F4}"]
let myName = String(myNameChar)
//OUTPUT: JUANSE🇨🇴

///Ejercicio 2. n = 36
print("\n Tabla del 36")
for n in 0...10 {
    print("36 X \(n) = \(36 * n)")
}

/*OUTPUT
Tabla del 36
36 X 0 = 0
36 X 1 = 36
36 X 2 = 72
36 X 3 = 108
36 X 4 = 144
36 X 5 = 180
36 X 6 = 216
36 X 7 = 252
36 X 8 = 288
36 X 9 = 324
36 X 10 = 360
*/
//Ejercicio 1
let nameReto : [Character] = ["A", "l", "e", "x", "a", "n", "d", "e", "r"," "]
let exclamationReto : Character =  "\u{1F1F5}\u{1F1EA}"
var nameStringReto = String(nameReto)
nameStringReto.append(exclamationReto)
print(nameStringReto)


//Ejercicio 2
for i in 0...10{
    print("Numero: 2 * \(i) es = \(i*3)"  )
}
let myName : [Character] = ["L", "u", "i", "s", " ", "A", "l", "b", "e", "r", "t", "o"]

let myNameString = String(myName)

print("Hola mi nombre es \(myNameString) y esta hecho a partir de un array de caracteres")


let number: Int = 4

for i in 0...9 {
    let count = i + 1
    let result = count * number
    print("El resultado de \(number) * \(count) es \(result)")
//RETO 1
let nameChars : [Character] = ["D","a","v","i","d","\u{1F1FB}\u{1F1EA}"]
var nameString = String(nameChars)
print(nameString)

//RETO 2
let five = 5
for i in 0...10 {
    print("\(five) * \(i) = \(five * i)")
}

Curiosamente en la clase pasada me puse a explorar todas estas funciones de los String y ya estaba jugando con ellas, y en esta clase me encuentro con el profesor las esta explicando, que Genial me ha parecido la clase!

Reto 2:

let myNumberInTable = 5

for multiplication in 0...10 // Rango Abierto
{
    print("\(myNumberInTable) * \(multiplication) = \(myNumberInTable * multiplication)")
}

Reto 1:

let myUsernameInCharacters : [Character] = ["n", "i", "x"]
let myFlag = "\u{1F1F2}\u{1F1FD}"
let myUsernameInStringNOW = String(myUsernameInCharacters)

let exclamation1 : Character = "¡"
let exclamation2 : Character = "!"

var myRegards = String()

myRegards.append(exclamation1)
myRegards.append("Holaaa")
myRegards.append(exclamation2)
myRegards.append(", mi nombre de usario es \"\(myUsernameInStringNOW)\" y soy de \(myFlag)")

print(myRegards)
//Reto1
let myNameChars: [Character] = ["D","a","v","i","d"]
var myNameString = String(myNameChars)
myNameString.append(flag)

//Reto2
let multiplieer = 5
for i in 1...10{
    print("\(i) * \(multiplieer) = \(i * multiplieer)")
}```

let threeTable = 3

for i in 0…9 {
let count = i+1
let multiply = count * threeTable
print(count, “*”, threeTable, multiply)
}

al final vi que la mayoría hizo el print de forma distinta, no se que tan bien se vea el mío haha cualquier comentario de critica constructiva se agradece!

//Reto 1
let country = "\u{1F1F2}\u{1F1FD}"
var myName = "Edgar"
myName.append(country)

//Reto 2
let num = 7
for i in 1…10 {
print("(num) * (i) = (num * i)")
}