Urgent help | Sololearn: Learn to code for FREE!

0

Urgent help

name = input ("Enter the name here" :) if name == "Nandhakumar" Print ("a") else: while name: If I entered wrong string it will go to else block. I Don't know how to write else block statement if I entered wrong string

10/8/2021 2:40:49 PM

NandhaKumar

3 Answers

New Answer

+2

Then its better to warp your program into function if your condition will be fail in else part you can again call function

+2

def getName(n): if n != "Nandhakumar": getName(input()) else: print("correct name") getName(input()) this code will give an error if you input the wrong name here on the ground, Because sololearn reads only in the startup

+1

Hope it help :) name = input ("Enter the name here" :) if (name == "Nandhakumar"): print ("a") else: print("You entered wrong string..")