I just started to learn Python (from the book "We study programming on Python", author Paul Berry - problems with examples) and I can not understand why the example does not work. Here is the code itself:

from flask import Flask, render_template from vsearch import search4letters app = Flask(__name__) @app.route('/') def hello() -> str: return 'Hello world from Flask!' @app.route('/search4', methods=['POST']) def do_search() -> str: return str(search4letters('life, the universe, and everything', 'eiru,!') @app.route('/entry') def entry_page() -> 'html': return render_teamplate('entry.html', the_title='Welcome to search4 letters on the web!') app.run(debug=True) 

When you run Ctrl + F5 crashes on line 18 on the declaration of the method - the message - "Invalid syntax". This may be due to the fact that I'm doing this from work? Those. right there what or what? Thank.

  • This error most likely signals that you have typed a code with a typo. Recheck again, more closely this line and the next. Although I don’t see anything suspicious about my eyes (I am not a Pythonist). Although ... maybe the quotes on the word html are not needed, such as this is the output type of the method? - AK
  • one
    Hint: you have an open bracket - andreymal
  • By the way, yes. Your number of opening brackets did not coincide with the number of closing brackets. Look just above line 18. - AK
  • Thank you, I did not notice the number of brackets - I made it correct and the error went away but another appeared - - aka86
  • one
    @ aka86, spare someone else's eyes! Put this stack of tracks in question, adding formatting :) - gil9red

0