Syntax error | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Syntax error

The function listed #new patient function is causing a syntax error before output even asks for input.. As far as I know, the functions code shouldn't be run until I input the string that I've bound to make the function start?? Can someone glance over it and give me any idea what's going wrong? https://code.sololearn.com/cEgXs1PGvTt5/?ref=app

31st Mar 2020, 4:39 PM
Christian Jacob O'Neill
Christian Jacob O'Neill - avatar
4 Answers
+ 2
You are not return written any function there.. While True: #this loop runs Infinitely until a break statement executed... Your condition for exit loop is enter "return". Code to work, your last try block is missing the exception handling.. And usin == str(input(" ")) here, use = not == = is for assigning, == for comparisons...
31st Mar 2020, 4:53 PM
Jayakrishna 🇮🇳
0
Corrected the input usin = str(input(" ")) thanks for pointing that out, However, the while true statement has worked in a similar project of mine.. I want to request user input so the user can use their choice of function and then go back to the user input request.. Im mot sure why it wont work. However it is claiming the break line has a syntax error which I don't see why
31st Mar 2020, 6:57 PM
Christian Jacob O'Neill
Christian Jacob O'Neill - avatar
0
Traceback (most recent call last): File "/data/user/0/ru.iiec.pydroid3/files/accomp_files/iiec_run/iiec_run.py", line 31, in <module> start(fakepyfile,mainpyfile) File "/data/user/0/ru.iiec.pydroid3/files/accomp_files/iiec_run/iiec_run.py", line 30, in start exec(open(mainpyfile).read(), __main__.__dict__) File "<string>", line 38 break ^ SyntaxError: unexpected EOF while parsing [Program finished]
31st Mar 2020, 7:03 PM
Christian Jacob O'Neill
Christian Jacob O'Neill - avatar
0
while True : works.. As not as you specified "should not run unt I input the string that I've bound to make the function start" But it works as "code doesn't end until you input the string that you have used as a stop condition" [here input string "return"]. I Specified in first post that your try block missing except block. So incomplete Program it is. Write except block for last try line 32's.....
31st Mar 2020, 7:11 PM
Jayakrishna 🇮🇳