Questions tagged [defined]

A definition is an unambiguous statement for the meaning of a word or phrase. In programming, a variable definition provides all the details for that variable.

304 questions
-1
votes
2 answers

Python: NameError: global name 'lol' is not defined

I know there are a lot of these but i've been searching for an hour and nothing is working. ship2X=eg.passwordbox("Player " + str(playerNumber) + " input the x co-ordinate for your SECOND ship ") ship2Y=eg.passwordbox("Player " +…
Shivam Paw
  • 11
  • 1
  • 4
-1
votes
2 answers

Weird HTML & JavaScript Error

I keep getting an error saying my function "key" is not defined. Here is the HTML code:
sanoj00
  • 73
  • 1
  • 2
  • 6
-1
votes
3 answers

Getting a "missing return statement"

Okay so this program is supposed to use a user defined method to find the numerical value of each character of a string and assign it to a number on a keypad... i.e. 1800FLOWERS to 18003569377 When i try to compile im getting a "missing return…
-1
votes
1 answer

Defined values in SQL statement

Just wondering what peoples opinions are about defining values inside SQL statements when using the prepared statements such as: $sql->query("SELECT * FROM ".TABLE_NAME." WHERE id = :id"); $sql->bind(':id', $id); Not all the code but you can see…
Jay
  • 68
  • 1
  • 10
-2
votes
1 answer

Creating a function that calls previously defined variables using the first part of the variable name

I'm trying to build a function that automatically calls previously defined variables using a portion of the name of these previously defined variables. For example: List=('USGS46', 'USGS47', 'USGS48', 'USGS50') USGS46_d17O= -15.6579 USGS46_d18O=…
lordseal92
  • 23
  • 6
-2
votes
3 answers

converting a list with cubed defined function on python

I have created a range list - [2, 4, 6, 8, 10] RangeList = list(range(2,11,2)) RangeList [2, 4, 6, 8, 10] I need to convert this list into [8, 64, 216, 512, 1000] The criteria i am working with: -use a for loop and the 'cubed' function…
esco
  • 71
  • 4
-2
votes
1 answer

Already defined function cannot use in idle?

I have a simple program that I'm trying to learn in python. I have defined the function as such >>> def area(base, height): return base * height /2 when I try to use the function as such >>> area(3,4) I am given this error saying that it…
Kevin
  • 1
-2
votes
1 answer

How to fix ' name "xxx" is not defined

In my program, I'm trying to run a "def command" in a conditional statement. An error pops up saying name 'command' is not defined. I tried to rewrite the code and tried to reload the repl.it server many times. def main(): inputmain =…
-2
votes
1 answer

How can I check if a method is defined?

I try to set the value of my variable to "", in the case that getLove is not defined: `$money = $dollar->getCash()->getLove ?? "";` But I get still the error message: Attempted to call an undefined method named "getLove" of class …
peace_love
  • 6,229
  • 11
  • 69
  • 157
-2
votes
2 answers

PHP Variables Defined As Other Variables

I'm attempting to use PHP to make a configuration file. I have the variables set up to output to a final variable. However, when I'm trying to echo the output, it won't appear. I've tried various solutions such as reformatting variables within the…
-2
votes
2 answers

Create a function that outputs spending level based on money spent - Python

How do I create a function that says that for example if a person spends 100 dollars they are bronze, whereas if they spend between 100 dollars and 200 dollars they are silver? I am trying to learn how to use user defined functions rather than…
Erika G
  • 11
-2
votes
3 answers

Python NameError: name '' is not defined

I am fairly new to python, i have created this code for a controlled assessment but it is suggesting that 'q11' (the first of the web opening commands) is not defined. It is the same as the others and was working fine before but now i have begun…
dbs
  • 1
  • 1
  • 2
-2
votes
3 answers

Python error: "global name 'counter1' is not defined"

My code: class Persistence: num = 0 counter1 = 0 counter2 = 0 def __init__(self, num): self.num = num #num = input("Enter a non-negative number:: ") if num < 0: raise NameError("Negative") #test…
jzhao23
  • 1
  • 1
-2
votes
1 answer

NameError: name 'q2' is not defined

I've just started python 3 practically yesterday and came across this error which I have no idea how to fix, could someone please help. Thanks! edit: its not the indentation, sorry the code here may have ended up with the wrong indentation when i…
-3
votes
2 answers

Java Variable Issue

I am writing a program that compares the difference between two strings, and I am getting an error with the variable shorterS, which is the shorter string out of the two. The compiler is saying "the variable is already defined in main method" int…
1 2 3
20
21