Search the Community
Showing results for tags 'for'.
-
Hi, I'm looking at this piece of code: words = ['cat', 'window', 'defenestrate'] for w in words[:]: if len(w) > 6: words.insert(0, w) words ['defenestrate', 'cat', 'window', 'defenestrate'] If I understand well it should make copy of the list and add 'defenestrate' into list but I receive a message "tuple object has no attribute instert". This code is a part of a tutorial I'm following and not sure why it doesn't work.
-
The comment basically has my issue, but I'm basically trying to fix my second var prompt so it will actually run and I can't figure it out. If anyone can help I would greatly appreciate it. Line comment: var one above this comment isn't working, how do I fix it? I also need it to continue to the next else if statement once something is entered. I'm thinking of making it so that if it changes var input to 2 once it's entered then 3, will that work? <!DOCTYPE html> <html> <head> <title>Project 1 – Michael Fiorello</title> <script> do{ var input = prompt ("Please enter 1, 2, 3, or exit.");{ if (input == "1") {for var one = prompt ("Please enter a string"); //var one above this comment isn't working, how do I fix it? I also need it to continue to the next else if statement once something is entered. I'm thinking of making it so that if it changes var input to 2 once it's entered then 3, will that work? if (one != null) else console.warn("You need to enter something") }in(one !="") //need the above "in" to cause it to loop this section until something is entered for var one else if (input == "2") { alert ("COOL!") } else if (input == "3") { alert ("AWESOME!") } else if (input.toLowerCase() == "exit") { alert ("Okay") } else { alert ("Nope") console.warn("You need to enter something"); } } }while(input != "exit"); </script> </head> <body> </body> </html>
- 9 replies
-
- help
- javascript
-
(and 8 more)
Tagged with:
-
Dear All; Need your help. I am programming students' roll call in ASP with SQL 2008 R2. There are about 100 students. By default option selected is 'Present' using drop down list. I tried to use radio buttons but only one button remains selected so I am using drop-down list ( How to select multiple radio buttons?). After selecting "Present", "Absent","Late" etc, how do I insert all 100( or whatever number) of rows in the SQL table simultaneously? How should I use "for", "loop" or any other method? Please guide. Regards DAMODAR
- 5 replies
-
- SQL 2008 R2
- ASP
- (and 7 more)