Why does type error show up even when there are no equal variable and function names?
up vote
0
down vote
favorite
I am having trouble regarding the Type Error. The function and variable names are not equal but its still giving me a Type Error.
def space():
spaces=' '
sp=print(spaces,end=' ')
return(sp)
def inc_num():
incr_num=print(num,end=' ')
return(incr_num)
def dec_num():
decr_num=print(k,end=' ')
k=k-1
return(decr_num)
def forward_pyramid():
no_of_rows=int(input("Enter the number of rows for the pyramid:"))
for row in range(1,no_of_rows):
for space in range(1,no_of_rows-row):
s=space()
return(s)
for num in range(1,row,1):
n=inc_num()
return(n)
for k in range(row,0,-1):
m=dec_num()
return(m)
forward_pyramid()
this is the error
python
add a comment |
up vote
0
down vote
favorite
I am having trouble regarding the Type Error. The function and variable names are not equal but its still giving me a Type Error.
def space():
spaces=' '
sp=print(spaces,end=' ')
return(sp)
def inc_num():
incr_num=print(num,end=' ')
return(incr_num)
def dec_num():
decr_num=print(k,end=' ')
k=k-1
return(decr_num)
def forward_pyramid():
no_of_rows=int(input("Enter the number of rows for the pyramid:"))
for row in range(1,no_of_rows):
for space in range(1,no_of_rows-row):
s=space()
return(s)
for num in range(1,row,1):
n=inc_num()
return(n)
for k in range(row,0,-1):
m=dec_num()
return(m)
forward_pyramid()
this is the error
python
3
Welcome to Stack Overflow. Please read the help pages, take the SO tour, read about how to ask good questions, as well as this question checklist. And please don't SHOUT!
– Some programmer dude
Nov 21 at 9:23
1
You should avoid using pictures in your question.
– BlueSheepToken
Nov 21 at 9:49
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I am having trouble regarding the Type Error. The function and variable names are not equal but its still giving me a Type Error.
def space():
spaces=' '
sp=print(spaces,end=' ')
return(sp)
def inc_num():
incr_num=print(num,end=' ')
return(incr_num)
def dec_num():
decr_num=print(k,end=' ')
k=k-1
return(decr_num)
def forward_pyramid():
no_of_rows=int(input("Enter the number of rows for the pyramid:"))
for row in range(1,no_of_rows):
for space in range(1,no_of_rows-row):
s=space()
return(s)
for num in range(1,row,1):
n=inc_num()
return(n)
for k in range(row,0,-1):
m=dec_num()
return(m)
forward_pyramid()
this is the error
python
I am having trouble regarding the Type Error. The function and variable names are not equal but its still giving me a Type Error.
def space():
spaces=' '
sp=print(spaces,end=' ')
return(sp)
def inc_num():
incr_num=print(num,end=' ')
return(incr_num)
def dec_num():
decr_num=print(k,end=' ')
k=k-1
return(decr_num)
def forward_pyramid():
no_of_rows=int(input("Enter the number of rows for the pyramid:"))
for row in range(1,no_of_rows):
for space in range(1,no_of_rows-row):
s=space()
return(s)
for num in range(1,row,1):
n=inc_num()
return(n)
for k in range(row,0,-1):
m=dec_num()
return(m)
forward_pyramid()
this is the error
python
python
edited Nov 21 at 9:44
Josh21
638
638
asked Nov 21 at 9:21
Zainab Binte Iftikhar
1
1
3
Welcome to Stack Overflow. Please read the help pages, take the SO tour, read about how to ask good questions, as well as this question checklist. And please don't SHOUT!
– Some programmer dude
Nov 21 at 9:23
1
You should avoid using pictures in your question.
– BlueSheepToken
Nov 21 at 9:49
add a comment |
3
Welcome to Stack Overflow. Please read the help pages, take the SO tour, read about how to ask good questions, as well as this question checklist. And please don't SHOUT!
– Some programmer dude
Nov 21 at 9:23
1
You should avoid using pictures in your question.
– BlueSheepToken
Nov 21 at 9:49
3
3
Welcome to Stack Overflow. Please read the help pages, take the SO tour, read about how to ask good questions, as well as this question checklist. And please don't SHOUT!
– Some programmer dude
Nov 21 at 9:23
Welcome to Stack Overflow. Please read the help pages, take the SO tour, read about how to ask good questions, as well as this question checklist. And please don't SHOUT!
– Some programmer dude
Nov 21 at 9:23
1
1
You should avoid using pictures in your question.
– BlueSheepToken
Nov 21 at 9:49
You should avoid using pictures in your question.
– BlueSheepToken
Nov 21 at 9:49
add a comment |
1 Answer
1
active
oldest
votes
up vote
1
down vote
You have declared a variable and function with the same name (space
). On that line, space is an int.
Change line 16:
for space in range(1,no_of_rows-row):
To something else:
for sp in range(1,no_of_rows-row):
And your error goes away.
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
You have declared a variable and function with the same name (space
). On that line, space is an int.
Change line 16:
for space in range(1,no_of_rows-row):
To something else:
for sp in range(1,no_of_rows-row):
And your error goes away.
add a comment |
up vote
1
down vote
You have declared a variable and function with the same name (space
). On that line, space is an int.
Change line 16:
for space in range(1,no_of_rows-row):
To something else:
for sp in range(1,no_of_rows-row):
And your error goes away.
add a comment |
up vote
1
down vote
up vote
1
down vote
You have declared a variable and function with the same name (space
). On that line, space is an int.
Change line 16:
for space in range(1,no_of_rows-row):
To something else:
for sp in range(1,no_of_rows-row):
And your error goes away.
You have declared a variable and function with the same name (space
). On that line, space is an int.
Change line 16:
for space in range(1,no_of_rows-row):
To something else:
for sp in range(1,no_of_rows-row):
And your error goes away.
answered Nov 21 at 9:24
richflow
731110
731110
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53408787%2fwhy-does-type-error-show-up-even-when-there-are-no-equal-variable-and-function-n%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
3
Welcome to Stack Overflow. Please read the help pages, take the SO tour, read about how to ask good questions, as well as this question checklist. And please don't SHOUT!
– Some programmer dude
Nov 21 at 9:23
1
You should avoid using pictures in your question.
– BlueSheepToken
Nov 21 at 9:49