Python True Keyword

The Python True keyword is a boolean value. It is returned from a comparison operator and when the result of comparison is True. It is also same as 1 (False is same as 0).

Comparison Scenarios with True Value

In the example below, different comparison scenarios are discussed that lead to True value.

x = [10, 20, 30]
y = x
z = [10, 20, 30]

print(10 > 5)

print(10 == 10)

print(10 != 5)

print(10 + 5 > 12)

print(x is y)

print(x is not z)

print(10 in [1, 5, 10, 15])

print(10 not in [1, 5, 15, 20])

The output of the above code will be:

True
True
True
True
True
True
True
True

❮ Python Keywords

5
{"ft_lang_label":"__label__en","ft_lang_prob":0.86126494,"math_prob":0.9908686,"size":612,"snap":"2022-05-2022-21","text_gpt3_token_len":189,"char_repetition_ratio":0.20230263,"word_repetition_ratio":0.033898305,"special_character_ratio":0.35620916,"punctuation_ratio":0.123188406,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.98392737,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2022-01-17T16:20:03Z\",\"WARC-Record-ID\":\"<urn:uuid:d943eed1-42a2-4c17-95db-923445f66e71>\",\"Content-Length\":\"25593\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:b28bd964-f68b-452e-820e-fbd010e56d4e>\",\"WARC-Concurrent-To\":\"<urn:uuid:503633b1-eadf-443e-b84b-b8b71f186b8c>\",\"WARC-IP-Address\":\"104.154.71.199\",\"WARC-Target-URI\":\"https://www.alphacodingskills.com/python/notes/python-keyword-true.php\",\"WARC-Payload-Digest\":\"sha1:VJQPD7QJR2P7IG44FD6ARPCAOCICN6P3\",\"WARC-Block-Digest\":\"sha1:AGXQMYA7Q7UBY6WZEZMZJS3XNJMRHCO3\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2022/CC-MAIN-2022-05/CC-MAIN-2022-05_segments_1642320300574.19_warc_CC-MAIN-20220117151834-20220117181834-00533.warc.gz\"}"}