futurecoder
futurecoder copied to clipboard
JS Error while running code: PythonError
User Issue Email: (not given) User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.67 Safari/537.36
Estaba tratando de hacer que hasta que el numero ingresado sea mayor igual a uno, lo divida por sus factores primos.
File "/lib/python3.9/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1004, in _find_and_load
File "<frozen importlib._bootstrap>", line 157, in __enter__
File "<frozen importlib._bootstrap>", line 172, in _get_module_lock
KeyboardInterrupt
Redux state
{"book":{"error":{"details":"Traceback (most recent call last):\n File \"/lib/python3.9/importlib/__init__.py\", line 127, in import_module\n return _bootstrap._gcd_import(name[level:], package, level)\n File \"<frozen importlib._bootstrap>\", line 1030, in _gcd_import\n File \"<frozen importlib._bootstrap>\", line 1004, in _find_and_load\n File \"<frozen importlib._bootstrap>\", line 157, in __enter__\n File \"<frozen importlib._bootstrap>\", line 172, in _get_module_lock\nKeyboardInterrupt\n","title":"JS Error while running code: PythonError"},"route":"ide","previousRoute":"main","pageSlugsList":["IntroducingTheShell","NavigatingShellHistory","IntroducingStrings","AddingStrings","IntroducingVariables","UsingVariables","WritingPrograms","StoringCalculationsInVariables","IntroducingForLoops","Indentation","BasicForLoopExercises","BuildingUpStrings","BuildingUpStringsExercises","BasicTerminology","IntroducingIfStatements","CombiningCompoundStatements","UnderstandingProgramsWithSnoop","IfAndElse","TheEqualityOperator","IntroducingElif","OtherComparisonOperators","IntroducingLists","BuildingNewLists","UsingBreak","GettingElementsAtPosition","GettingElementsAtPositionExercises","CallingFunctionsTerminology","FunctionsAndMethodsForLists","MoreListFunctionsAndMethods","StringMethodsUnderstandingMutation","HowToFindInformationWithGoogleAndMore","UnderstandingProgramsWithPythonTutor","EqualsVsIs","ModifyingWhileIterating","SingleAndDoubleQuotesInStrings","IntroducingFstrings","IntroducingNestedLoops","IntroducingBirdseye","IntroducingNestedLists","LoopingOverNestedLists","DefiningFunctions","CallingFunctionsWithinFunctions","ReturningValuesFromFunctions","TestingFunctions","MoreOnReturn","IntroducingOr","IntroducingAnd","MultiLineExpressions","CombiningAndAndOr","IntroducingNotPage","IntroducingTicTacToe","NewlinesAndFormatBoard","Types","InteractiveProgramsWithInput","NestedListAssignment","MakingTheBoard","TheFullTicTacToeGame"],"user":{"uid":"YRZBP5Csr4alZ4rq2dtuvaOh7X73","email":null,"developerMode":false,"pageSlug":"IntroducingTheShell","pagesProgress":{"IntroducingTheShell":{"step_name":"first_expression"},"NavigatingShellHistory":{"step_name":"final_text"},"IntroducingStrings":{"step_name":"hello_string"},"AddingStrings":{"step_name":"hello_world_concat"},"IntroducingVariables":{"step_name":"word_assign"},"UsingVariables":{"step_name":"name_assign"},"WritingPrograms":{"step_name":"editor_hello_world"},"StoringCalculationsInVariables":{"step_name":"sentence_equals_word_plus_name"},"IntroducingForLoops":{"step_name":"first_for_loop"},"Indentation":{"step_name":"missing_indentation"},"BasicForLoopExercises":{"step_name":"loop_exercise_1"},"BuildingUpStrings":{"step_name":"hello_plus_equals"},"BuildingUpStringsExercises":{"step_name":"name_triangle_spaced"},"BasicTerminology":{"step_name":"final_text"},"IntroducingIfStatements":{"step_name":"introducing_booleans"},"CombiningCompoundStatements":{"step_name":"for_inside_if"},"UnderstandingProgramsWithSnoop":{"step_name":"print_tail"},"IfAndElse":{"step_name":"first_if_else"},"TheEqualityOperator":{"step_name":"introducing_equality"},"IntroducingElif":{"step_name":"dna_example"},"OtherComparisonOperators":{"step_name":"try_not_equals"},"IntroducingLists":{"step_name":"first_list"},"BuildingNewLists":{"step_name":"double_numbers"},"UsingBreak":{"step_name":"list_contains_exercise"},"GettingElementsAtPosition":{"step_name":"introducing_subscripting"},"GettingElementsAtPositionExercises":{"step_name":"index_exercise"},"CallingFunctionsTerminology":{"step_name":"print_functions"},"FunctionsAndMethodsForLists":{"step_name":"append_vs_concatenate"},"MoreListFunctionsAndMethods":{"step_name":"sorted_predict_exercise"},"StringMethodsUnderstandingMutation":{"step_name":"string_in_step"},"HowToFindInformationWithGoogleAndMore":{"step_name":"sum_list"},"UnderstandingProgramsWithPythonTutor":{"step_name":"run_with_python_tutor"},"EqualsVsIs":{"step_name":"two_separate_lists"},"ModifyingWhileIterating":{"step_name":"run_broken_with_python_tutor"},"SingleAndDoubleQuotesInStrings":{"step_name":"single_quotes_apostrophe"},"IntroducingFstrings":{"step_name":"introduce_f_strings"},"IntroducingNestedLoops":{"step_name":"first_nested_loop"},"IntroducingBirdseye":{"step_name":"first_birdseye_example"},"IntroducingNestedLists":{"step_name":"string_list_exercise"},"LoopingOverNestedLists":{"step_name":"nested_list_nested_loop_example"},"DefiningFunctions":{"step_name":"define_greet"},"CallingFunctionsWithinFunctions":{"step_name":"print_twice_call_print_many"},"ReturningValuesFromFunctions":{"step_name":"first_return"},"TestingFunctions":{"step_name":"introducing_assert_equal"},"MoreOnReturn":{"step_name":"double_return_in_one_function"},"IntroducingOr":{"step_name":"InputAliceBob"},"IntroducingAnd":{"step_name":"TrueAndTrue"},"MultiLineExpressions":{"step_name":"invalid_multiline"},"CombiningAndAndOr":{"step_name":"CombiningAndOr"},"IntroducingNotPage":{"step_name":"IntroducingNot"},"IntroducingTicTacToe":{"step_name":"intro_row_winner"},"NewlinesAndFormatBoard":{"step_name":"one_way_to_print_board"},"Types":{"step_name":"five_different_types"},"InteractiveProgramsWithInput":{"step_name":"first_input"},"NestedListAssignment":{"step_name":"modify_list_in_function"},"MakingTheBoard":{"step_name":"naive_make_board"},"TheFullTicTacToeGame":{"step_name":"the_full_game"}}},"processing":true,"running":true,"numHints":0,"editorContent":"def factores_primos(numero):\r\n divisores=0 \r\n contador=1\r\n primos=[]\r\n factores_primos=[]\r\n subcontador=1\r\n num=1\r\n n=0\r\n resultado_factores=[]\r\n factores=0\r\n while subcontador<numero:\r\n while contador<=numero:\r\n if numero%contador==0:\r\n divisores=divisores + 1\r\n contador=contador + 1\r\n if divisores==2:\r\n primos.append(numero)\r\n contador=1\r\n divisores=0\r\n num=num +1\r\n numero=numero-1\r\n limite=len(primos)\r\n while n<limite:\r\n if num%(primos[n])==0:\r\n factores_primos.append(primos[n])\r\n factores_primos.sort() \r\n limite=limite-1\r\n n=n+1\r\n while num>=1:\r\n limite_f=len(factores_primos)\r\n while factores<limite_f:\r\n resultado=num%(factores_primos[factores])\r\n num=num/(factores_primos[factores])\r\n if resultado==0:\r\n resultado_factores.append(factores_primos[factores])\r\n else:\r\n resultado_factores.sort()\r\n resultado_factores.sort()\r\n limite_f=limite_f -1\r\n return resultado_factores\r\ndef principal():\r\n \"\"\"Esta función se encarga de la parte 'interactiva' del programa.\r\n \"\"\"\r\n numero=int(input(\"Ingrese un número entero positivo: \"))\r\n print(factores_primos(numero))\r\nif __name__ == \"__main__\":\r\n principal()\r\n","messages":["<p>Fabuloso, ¡estás probando tus propios experimentos!\nEs una gran señal. Sigue así.\nSólo te hago saber que al final tienes que escribir <code>1+2</code> para que la lección avance.</p>"],"pastMessages":["<p>Fabuloso, ¡estás probando tus propios experimentos!\nEs una gran señal. Sigue así.\nSólo te hago saber que al final tienes que escribir <code>1+2</code> para que la lección avance.</p>"],"requestingSolution":0,"prediction":{"choices":null,"answer":"","wrongAnswers":[],"userChoice":"","state":"hidden","codeResult":{}},"questionWizard":{"messages":[],"requestExpectedOutput":false,"expectedOutput":""}}}