write a program in phyton to take as input a character and determine the entered character is an alphabet or a digit or any non -zero character.
please do the program correctly.
Answers
Answered by
1
IN PYTHON:
char = input("Please type your character here: ")
if (char>='A' and char<='Z') or (char>='a' and char<='z'):
print ("Its an alphabet)
else if (char>='0' and char<='9'):
print ("Its a number)
else:
print ("Its a non-zero character")
IN C++:
#include <bits/stdc++.h>
using namespace std;
int main() {
string char;
cout << "Please type your character here: ");
cin >> char;
if ((char>='A' && char<='Z') || (char>='a' && char<='z')) cout << "Alphabet" << endl;
else if (char>='0' && char<='9') cout << "Number" << endl;
else cout << "Non-zero character" << endl;
return 0;
}
Anonymous:
thanks for the answer
Similar questions
English,
7 months ago
Physics,
7 months ago
English,
7 months ago
Social Sciences,
1 year ago
Math,
1 year ago