Questions tagged [isalpha]

83 questions
-2
votes
2 answers

Trying to make a loop which counts letters but not spaces

I am trying to construct a simple programme which counts the number of letters in a user's input. My idea was to use a for loop which would loop for each letter in a string, increment a counter, and return the final counter total at the end.…
BlueKhakis
  • 293
  • 1
  • 8
-2
votes
2 answers

How to use str.isalpha()?

I insert 'Sharon' as my input but it still keeps printing "Not in alphabets". What should I do to print("In alphabets") while my input is in alphabets?
shino
  • 3
  • 2
-3
votes
2 answers

python say isalpha() is not defined despite it being built in (I think)

i am running a program that takes a list of numbers and letters, and separates the numbers into a sperate list and printing that list, but every time i run the code it says that isalpha is not defined. yes = [] item=[1,7,-10,34,2,"a",-8] for things…
conronro
  • 1
  • 1
-3
votes
1 answer

isalpha in c++ not working correctly for single integer

I made a code to convert nfa to dfa using stl(vectors). In this code isalpha() is not working. The if block below isalpha doesnt do anything. If i enter an alphabet it prints all the cout below it I tried using…
Priyank
  • 111
  • 1
  • 7
-4
votes
1 answer

I'm trying to count non integers in double arrays in Python

I'd like to count the number of non integers in double array. For example Input: mylist=[['a',-2,'b',-3,1],['c','a',-1,1,3],['d','f'],['e',3],[-11]] Output: num_value(mylist)=7 Show me how to make it.
Micheal C
  • 29
  • 5
-5
votes
3 answers

Program keeps returning Segmentation Fault

I'm a new person who loves to play around with coding. Recently I was going through a course on edx, and one of the exercises I need to complete has this small code snippet that keeps on giving Segmentation fault. I have taken out the faulty bit…
-6
votes
1 answer

Check it is number or not and import sys on python

I just want to know how can i check it is number or not in import sys situation. and want to know Why i didn't get output "Hello" with code A.isalpha()
-8
votes
1 answer

C Program to count number of alphabets in a word giving error

Following is the code: #include int main() { int alpha = 0, input; while((input = getchar() != EOF)) { if(isalpha(input)) alpha++; } printf("Num of alpha is %d", alpha); return(0); } I'm…
1 2 3 4 5
6