0

help me come up with a java script in python

According to the description of R-rated films: Children under 17 require an accompanying parent or adult guardian (age 21 or older) and adults 25 years and under must show ID. And children under the age of 6 are not allowed in after 6:00pm. Deadpool is an R-rated movie. Write a JavaScript function named canIWatch that will take age as a parameter. If the age is less than 6, return You are not allowed to watch Deadpool after 6.00pm. If the age is 6 or more but less than 17, return You must be accompanied by a guardian who is 21 or older. If the age is 17 or more but less than 25, return You are allowed to watch Deadpool, right after you show some ID. If the age is 25 or greater, return Yay! You can watch Deadpool with no strings attached!. If the age is invalid, return Invalid age.

21st Nov 2016, 4:49 PM
Chalo Onkoba
Chalo Onkoba - avatar
2 odpowiedzi
+ 2
function caniwatch(age) { var allow; switch age{ case(age>5 && age>18): allow="parents permission required"; case(age>17&& age<25): allow="proof your age"; case(age>25): allow="you are okay"; default: allow="invalid age entered" } return allow; } but where is Python here I need to know why Python uses js is it python tell me please
21st Nov 2016, 5:32 PM
Sandeep Chatterjee
+ 1
ok, you can use python to render html. In that html include the relevant js file reference. in your javascript do grab a user input and store in a variable. simply put the variable through a switch case or if statement. render the output to a html div like header...
21st Nov 2016, 5:24 PM
Jonathan
Jonathan - avatar