CoCalc Public FilesEjercicios basicos 1-1.sagewsOpen with one click!
Author: CrowTea
Views : 115
Compute Environment: Ubuntu 18.04 (Deprecated)
a = int(input("Introduce el dividendo: ")) b = int(input("Introduce el divisor: ")) c = a // b d = a % b c d
Error in lines 1-1 Traceback (most recent call last): File "/cocalc/lib/python2.7/site-packages/smc_sagews/sage_server.py", line 1234, in execute flags=compile_flags), namespace, locals) File "", line 1, in <module> File "/cocalc/lib/python2.7/site-packages/smc_sagews/sage_salvus.py", line 3678, in input return input(*args, **kwds) File "/cocalc/lib/python2.7/site-packages/smc_sagews/sage_salvus.py", line 3678, in input return input(*args, **kwds) File "/cocalc/lib/python2.7/site-packages/smc_sagews/sage_salvus.py", line 3678, in input return input(*args, **kwds) [Previous line repeated 985 more times] RecursionError: maximum recursion depth exceeded
#Ejercicio 2 #Introducir los numeros a y b a = 619 b = 45 #Ecuacion euclidea w = walltime() wq = walltime() q = a // b print(walltime(wq) , "Segundos del cociente") wr = walltime() r = a % b print(walltime(wr) , "Segundos del resto") print(walltime(w) , "Segundos totales") #Resultados print("Cociente " , q) print("Resto " , r)
0.000202178955078125 Segundos del cociente 0.00016045570373535156 Segundos del resto 0.0013835430145263672 Segundos totales Cociente 13 Resto 34
#Ejercicio 3 #Introducir los numeros a y b a = int (input("Introduce el dividendo: ")) b = int (input("Introduce el divisor: ")) #Ecuacion euclidea w = walltime() q = 0 r = a if r < 0: #Valor Absoluto en caso de negativo. Posible implementacion abs r = -r while r >= b: r = r - b q = q + 1 if a < 0 and r >= 0: r = b - r q = -(q + 1) print(walltime(w) , ' Segundos') #Resultados print("Cociente " , q) print("Resto " , r)
Introduce el dividendo:
Introduce el divisor:
Error in lines 8-10 Traceback (most recent call last): File "/cocalc/lib/python2.7/site-packages/smc_sagews/sage_server.py", line 1188, in execute flags=compile_flags), namespace, locals) File "", line 1, in <module> File "src/cysignals/signals.pyx", line 320, in cysignals.signals.python_check_interrupt KeyboardInterrupt