logo

Crowdly

En el siguiente programa estamos leyendo números, introducidos por un usuario, r...

✅ The verified answer to this question is available below. Our community-reviewed solutions help you understand the material better.

En el siguiente programa estamos leyendo números, introducidos por un usuario, repetidamente para calcular y mostrar sus potencias.

Complete el código para tratar la excepción ValueError:

while True:

:

x = int(input('next number: '))

print(x**2)

ValueError:

print('Good bye!')

break

Ejemplo con diferentes entradas en que la excepción ValueError se lanza cuando una entrada —para la que se ha tecleado «end»— no puede ser convertida a int:

x: 1

1

x: 2

4

x: 10

100

x: end

Good bye!

More questions like this

Want instant access to all verified answers on aulaga.dis.ulpgc.es?

Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!