• Register
0 votes
238 views

Problem :

In Python, code blocks are defined by the tabs, not by the ";" at the end of the line

if number > 10 and number < 25:
    print "1"

Is mutliple lines possible in python? like...

if number > 10 
and number < 25:
    print "1"

6 5 3
6,930 points

Please log in or register to answer this question.

1 Answer

0 votes

Solution : 

PFB the solution for your problem

Method 1: Using parenthesis

if (number > 5 and
        number < 15):
    print "1"
Method 2: Using backslash
if number > 5 and \
number < 15:
    print "1"

Method 3: Using backslash + indent for better readability

if number > 5 and \
        number < 15:
    print "1"

9 7 4
38,600 points

Related questions

0 votes
1 answer 4 views
4 views
Problem: Any solution to this issue > When python is running in the interactive mode and displaying the chevron prompt
asked Apr 26 ummeshani 8.8k points
0 votes
1 answer 13 views
13 views
Problem: I am having problems with this Python program I am creating to do maths, working out and so solutions but I'm getting the syntax error: "unexpected character after line continuation character in python&rdquo;
asked Mar 16 ummesalma 29.2k points
0 votes
1 answer 11 views
11 views
Problem: My Python program is giving below error: python unexpected character after line continuation character
asked Mar 13 Wafa Abu Yousef 6.1k points
0 votes
3 answers 2.2K views
2.2K views
Problem : My Python program is giving below error python unexpected character after line continuation character
asked Oct 22, 2019 peterlaw 6.9k points
0 votes
1 answer 3 views
3 views
Problem: I have been using Python more and more, and I keep seeing the variable __all__ set in different __init__.py files. Can someone explain what this does?
asked Apr 25 muktaa 34.4k points
1 vote
1 answer 1 view
1 view
Problem: I am developing a videogame with pythopn but I get this error; Typeerror: 'nonetype' object has no attribute '__getitem__'.
asked Apr 25 PkGuy 23.5k points
0 votes
1 answer 3 views
3 views
Problem: Please help me to solve it&hellip;. nameerror: name '_name_' is not defined
asked Mar 31 Ifra 34.7k points
0 votes
1 answer 9 views
9 views
Problem: I'm new to Python and I keep getting this error: TypeError: 'type' object has no attribute '__getitem__'
asked Mar 16 ummesalma 29.2k points
0 votes
1 answer 4 views
4 views
Problem: As I previously mentioned in my question, I am stuck while studying. Could someone help assist me in completing my project?
asked Mar 30 rakib1 51.5k points
1 vote
1 answer 4 views
4 views
Problem: I want to know if there is official way or tool that allows multiple installations of python on the same machine in Linux ?
asked Mar 30 Raj Tyagi 14.4k points