Em: lab menys bonus, pero mira els missatges d'error :')#10
Em: lab menys bonus, pero mira els missatges d'error :')#10emmacunill wants to merge 1 commit intoIronhack-data-bcn-oct-2023:mainfrom
Conversation
|
Hello Emma:) Te dejo algunas cosillas pero buen lab en general!! Poco a poco la cosa va cogiendo ritmo:) Felicidades 💥
square = [i ** 2 for i in range(0,21)]
print(square)Si quieres incluir el cuadrado de 20 en la lista, debes ajustar el rango a 21!
sqrt = [math.sqrt(i) for i in range(0,101)]
print(sqrt)Te pide la raíz cuadrada los 100 primeros números, en tu rango especificas
Tu solución es correcta pero tal y como has especificado el range en otros casos no estarías incluyendo el
vowels = "aeiouAEIOU"
non_vowels = [i for i in teststring if i.lower() not in vowels and i != ' ']
print(non_vowels)Te dejo un pequeño tip!!!! Si añades
Idem que en ejercicio anterior:) Puedes añadir Te dejo el BONUS también:
def square_cal():
x = input("Insert an integer to square")
integer=False
while integer == False:
try:
x= int(x)
integer == True
return x**2
except ValueError as error:
x = input(f"{error}, please insert an valid integer to square")
square_cal()
results = list(set([num for div in range(2,10) for num in range(1,1001) if num%div == 0]))
print(results)
class NumSectionsError(Exception):
pass
while True:
try:
Total_Marks = int(input("Enter Total Marks Scored: "))
break
except ValueError as error:
print(error)
while True:
try:
Num_of_Sections = int(input("Enter Num of Sections: "))
if Num_of_Sections > 2:
raise NumSectionsError
else:
break
except ValueError as error:
print(error)
except NumSectionsError:
print("The number of sections can't be bigger than 2") A ver chica, muy bien ehhhhhhhh 🌻🌻🌻🌻🌻 |

No description provided.