Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

255
Views
Convirtiendo Python a JS

Necesito ayuda para entender cómo convertir código de Python a JS. Básicamente, estoy tratando de hacer una serie de preguntas S/N que siguen junto con un diagrama de flujo. Utilicé if elif anidado en python y me sugirieron usar bloques if anidados con JS, pero no estoy seguro de cómo hacerlo.

Estoy convirtiendo este cuestionario de diagrama de flujo en un chatbot y habrá un botón de sí o no para hacer clic cuando aparezca cada pregunta y, según la respuesta, aparecerá otra pregunta o el programa finalizará. Espero que esto ayude a explicar mi problema. Aquí hay un ejemplo del código python que tengo para la referencia que debe convertirse a JS:

 question1 = input("Do you like the color green? Please select yes or no: ") if question1 == "yes": # Do this. print("You have answered YES to the previous question") if question1 == "yes": question2y = input("Do you like wearing green? Please select yes or no: ") if question2y == "yes": print("Thanks for taking the survey") elif question1 == "no": # Do that. print("You have answered NO to the previous question") if question1 == "no": question2n = input("Do you like the color Blue? Please select yes or no: ") if question2n == "yes": print("You have answered YES to the previous question") elif question2n == "no": print("You have answered NO to the previous question") else: print("Please select yes or no.")
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!