Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Python error please help

Posted on 2007-11-20
1
Medium Priority
?
196 Views
Last Modified: 2010-04-16
Im obviously missing something, I keep getting moo = 14, then I thought maybe it means length of fourteen but no and its not 2 either so im getting irritated.

var foo = 5 + 6 * 7
var bar = foo % 8
var moo = bar * 2
var rar = moo / 3
function check(x)
{
        if (x.length == moo)
        {
                        alert("win!");
                        window.location += "?lvl_password="+x;
        } else {
                        alert("fail D:");
     }
}
0
Comment
Question by:tsmithinnc
1 Comment
 
LVL 19

Accepted Solution

by:
darron_chapman earned 2000 total points
ID: 20323736
foo = 5 + 6 * 7
foo = 5 + (6*7)
foo = 5 + 42
foo = 47
bar = 47 % 8
bar = 7
moo = 7 * 2
moo = 14

Moo should equal 14
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Less strange, but still introduction This introduction was added (1st August, 2011) to reflect some reactions.  Firstly, the term basics in the title of the article...  As any other word, it is a symbol with meaning attached to the word by some a…
Variable is a place holder or reserved memory locations to store any value. Which means whenever we create a variable, indirectly we are reserving some space in the memory. The interpreter assigns or allocates some space in the memory based on the d…
Learn the basics of strings in Python: declaration, operations, indices, and slicing. Strings are declared with quotations; for example: s = "string": Strings are immutable.: Strings may be concatenated or multiplied using the addition and multiplic…
Learn the basics of while and for loops in Python.  while loops are used for testing while, or until, a condition is met: The structure of a while loop is as follows:     while <condition>:         do something         repeate: The break statement m…
Suggested Courses

926 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question