{"id":146,"date":"2021-09-27T11:48:26","date_gmt":"2021-09-27T11:48:26","guid":{"rendered":"https:\/\/ethosspace.com\/programmers\/?p=146"},"modified":"2021-09-27T11:48:27","modified_gmt":"2021-09-27T11:48:27","slug":"python-code-to-check-if-character-is-alphabet-or-number","status":"publish","type":"post","link":"https:\/\/ethosspace.com\/programmers\/python-code-to-check-if-character-is-alphabet-or-number\/","title":{"rendered":"Python code to check if character is alphabet or number"},"content":{"rendered":"\n<p>Below python code will identify character whether it is alphabet or number using comparison and built in function like isalpha, isdigit<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\n# Program to check if character is alphabet or not.\n\n#Take user input and store it in variable ch\nch = input(\"Enter a character to check if character is alphabet or not: \")\n#comparing characters with a to Z or A to Z \n\nif((ch>='a' and ch&lt;= 'z') or (ch>='A' and ch&lt;='Z')):\n    print(ch, \"is an Alphabet\")\nelse:\n    print(ch, \"is not an Alphabet\")\n\n# using IsAlpha function\nif (ch.isalpha()):\n    print(ch, \"is an Alphabet identified using Is ALPHA function\")\nelse:\n    print(ch, \"is not an Alphabet\")\n\n# using IS digit function\nif(ch.isdigit()):\n    print(ch, \"is an number identified using IS Digit function\")<\/code><\/pre>\n\n\n\n<div style=\"height:25px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<pre class=\"wp-block-code\"><code>  \u2002\r\nEnter a character to check if character is alphabet or not: \r\n5\r\n5 is not an Alphabet\r\n5 is not an Alphabet\r\n5 is an number identified using IS Digit function\n\n  \u2002\r\nEnter a character to check if character is alphabet or not: \r\ns\r\ns is an Alphabet\r\ns is an Alphabet identified using Is ALPHA function<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Below python code will identify character whether it is alphabet or number using comparison and built in function like isalpha, isdigit<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_uag_custom_page_level_css":"","footnotes":""},"categories":[11],"tags":[],"class_list":["post-146","post","type-post","status-publish","format-standard","hentry","category-running-code-and-program"],"aioseo_notices":[],"uagb_featured_image_src":{"full":false,"thumbnail":false,"medium":false,"medium_large":false,"large":false,"1536x1536":false,"2048x2048":false,"sparkling-featured":false,"sparkling-featured-fullwidth":false,"tab-small":false},"uagb_author_info":{"display_name":"program45_-rt8nb","author_link":"https:\/\/ethosspace.com\/programmers\/author\/program45_-rt8nb\/"},"uagb_comment_info":0,"uagb_excerpt":"Below python code will identify character whether it is alphabet or number using comparison and built in function like isalpha, isdigit","_links":{"self":[{"href":"https:\/\/ethosspace.com\/programmers\/wp-json\/wp\/v2\/posts\/146","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ethosspace.com\/programmers\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ethosspace.com\/programmers\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ethosspace.com\/programmers\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ethosspace.com\/programmers\/wp-json\/wp\/v2\/comments?post=146"}],"version-history":[{"count":1,"href":"https:\/\/ethosspace.com\/programmers\/wp-json\/wp\/v2\/posts\/146\/revisions"}],"predecessor-version":[{"id":147,"href":"https:\/\/ethosspace.com\/programmers\/wp-json\/wp\/v2\/posts\/146\/revisions\/147"}],"wp:attachment":[{"href":"https:\/\/ethosspace.com\/programmers\/wp-json\/wp\/v2\/media?parent=146"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ethosspace.com\/programmers\/wp-json\/wp\/v2\/categories?post=146"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ethosspace.com\/programmers\/wp-json\/wp\/v2\/tags?post=146"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}