I want condition statement is to be run inside the isalpha condition | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

I want condition statement is to be run inside the isalpha condition

is and elif part in inner condition are not running only else part us running in inner conditions. how to run if and. elif part

10th Jan 2017, 11:14 AM
Lakshay Singhal
Lakshay Singhal - avatar
3 Answers
+ 1
ok thank you both.. the. type of coding I wanted to run was of the type that ramzi has sent firstly but my coding was not running as I was taking input by user using raw_input and then comparing it with an integer.. that's why they were unequal so if and elif part were not running
11th Jan 2017, 3:56 PM
Lakshay Singhal
Lakshay Singhal - avatar
0
Python uses indentation, which means you have to put spaces. if 1==1: [4spaces_here]print("1 is equal to1") [4spaces_here]if 1==2: [8spaces_here] print("1 is equal to 2") [4spaces_here]else: [8spaces_here] print("1 is not equal to 2") else: [4spaces_here] print ("1 is not equal to 1") basically everything you want inside the condition should be spaced by 4 spaces.
10th Jan 2017, 12:18 PM
ramzi
ramzi - avatar
0
here's another program: number=int(input("please put a number: ")) if number <0: print("your number is negative") elif number>100: print("your number is bigger then 100") else: if number<50: print("your number is positive and smaller than 50") else: print("your number is between 50 and 100") all the spacings I made are crucial and the program won't work if I don't put them exactly here I put them at the begining of the lines
10th Jan 2017, 9:51 PM
ramzi
ramzi - avatar