Python Error saying NameError global name true is not defined

0 votes

I'm trying to execute the following Python code:

def monotonic(a):
    n = len(a)
    for i in range(n):
        if((a[i]<a[i+1]) or (a[i]>a[1+1])):
            return true
a = [6, 5, 4, 3, 2]
print(monotonic(a))

And I get the following error:

NameError: global name 'true' is not defined
Jun 17, 2019 in Python by Trisha
16,194 views

1 answer to this question.

0 votes

It's a very small mistake. Change true to True. It should work. Python is case-sensitive.

This should work.

To know more, It's recommended to join our Python Training in Chennai today.

answered Jun 17, 2019 by Vinayak

edited Oct 7, 2021 by Sarfaraz
tp_dumm.drop(['town','west windsor'],axis="coulmns",inplace=Ture)

## hear Ture is not defnd error

Related Questions In Python

0 votes
1 answer

Python error "Python NameError: global name 'Thread' is not defined"

There is a built-in function with the ...READ MORE

answered May 31, 2019 in Python by Riya
7,300 views
–1 vote
1 answer

Python error saying "NameError: name 'email' is not defined"

you need to define the variable email READ MORE

answered Nov 29, 2019 in Python by Casper
• 160 points
6,833 views
0 votes
1 answer

Python argparse error "NameError: name 'file' is not defined"

The right datatype for destination in argpasrse module ...READ MORE

answered Nov 28, 2018 in Python by Omkar
• 69,220 points
13,703 views
0 votes
3 answers

Python error "NameError: name 'sr' is not defined"

NameError: name 'xx' is not defined Python knows ...READ MORE

answered Mar 19, 2020 in Python by rahul
• 360 points
42,576 views
0 votes
2 answers
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 7, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 4,434 views
0 votes
1 answer
+5 votes
6 answers

Lowercase in Python

You can simply the built-in function in ...READ MORE

answered Apr 11, 2018 in Python by hemant
• 5,790 points
4,067 views
0 votes
1 answer

What to do when I get and error saying python not recognized as internal or external command?

You need to set up the path ...READ MORE

answered May 28, 2019 in Python by Fata
• 1,050 points
2,464 views
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP