+ 3
Validation funcation to test the established funcation
https://pythonprinciples.com/challenges/Solution-validation/ How can will be the mechanism for this challenge
8 Respostas
+ 5
You receive a string as input and check all the things step by step and output messages as described. That‘s all. It looks more difficult than it is.
+ 3
But there in the description will be requested to work in following way:
def validate(mystr):
if 'def' not in mystr:
return 'missing def'
# etc. … your code
+ 2
JaScript but how i can write code in output screen because there is also condition of return statment?
+ 2
This the same as here, with the print statement:
myin = input()
if 'def' not in myin:
print('missing def')
+ 2
👍
+ 1
Mohammed Hassan ,
Nice challenge site.
I notice that the "Solution Validation" challenge is rated difficulty 5/10. There are 18 challenges of lower difficulty than that. If you're having trouble understanding this one, maybe you should finish those first.
https://pythonprinciples.com/challenges/
+ 1
def validate(f):
if 'def' not in f:
return 'missing def'
if ':' not in f:
return 'missing :'
if ( '(' not in f and ')' not in f ) :
return 'missing paren'
if chr(40)+chr(41) in f:
return 'missing param'
if ' ' not in f:
return 'missing indent'
if 'validate' not in f:
return 'wrong name'
if 'return' not in f:
return 'missing return'
return True
0
How to find sum of odd number