I was written the python program am getting error message IndentationError expected an indented block

0 votes
size_of_cargo1 = input()#take size of cargo number 1 as input from user
size_of_cargo2 = input()#take size of cargo number 2 as input from user
size_of_cargo3 = input()#take size of cargo number 3 as input from user
size_of_cargo4 = input()#take size of cargo number 4 as input from user
Raegan_cargo = input()

#if size of all the cargos is less than the Raegan cargo number, it means the Raegan container will not be filled in any container
if(size_of_cargo1+size_of_cargo2+size_of_cargo3+size_of_cargo4<=Raegan_cargo):
   print("Not Possible\n")
else:
#if raegan cargo number is between 0 to (size_of_cargo1-1),
if(Raegan_cargo-size_of_cargo1<0):
    print "1"
#if raegan cargo number is between size_of_cargo1 to (size_of_cargo2-1),
elif (Raegan_cargo-size_of_cargol-size_of_cargo2<0):
    print "2"
#if raegan cargo number is between size_of_cargo2 to (size_of_cargo3-1),
elif (Raegan_cargo-size_of_cargol-size_of_cargo2-size_of_cargo3<0):
    print "3"
#if raegan cargo number is between size_of_cargo3 to (size_of_cargo4-1),
else:
    print "4"

File "<string>", line 12
    if(Raegan_cargo-size_of_cargo1<0):
    ^
IndentationError: expected an indented block
>>>
May 27, 2020 in Python by anonymous
• 120 points

edited May 27, 2020 by Gitika 1,807 views

1 answer to this question.

0 votes

Hi@Thiyagarajan,

You have one else block in your code. But you didn't write anything inside this block.

if(size_of_cargo1+size_of_cargo2+size_of_cargo3+size_of_cargo4<=Raegan_cargo):
   print("Not Possible\n")
else:
#if raegan cargo number is between 0 to (size_of_cargo1-1),

If your below code comes under this else block, then indent your below code with respect to this else block.

answered May 27, 2020 by MD
• 95,060 points

Related Questions In Python

0 votes
3 answers

Python error "IndentationError: expected an indented block"

IndentationError:  what is the mean READ MORE

answered Oct 14, 2020 in Python by anonymous
• 140 points
104,656 views
0 votes
1 answer

I've been trying to run this code, but the error says "Expected an indented block" for the line, " word_as_list[index] = guess."

Hi, @Paradox, The error message IndentationError: expected an indented ...READ MORE

answered Nov 20, 2020 in Python by anonymous
• 65,870 points
138 views
0 votes
1 answer

Why am I getting a error when I am printing two different data types in python?

different data type is being used. that ...READ MORE

answered Mar 6, 2019 in Python by Mohammad
• 3,210 points
149 views
0 votes
2 answers
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 6, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 1,843 views
0 votes
0 answers
+4 votes
6 answers

Lowercase in Python

You can simply the built-in function in ...READ MORE

answered Apr 11, 2018 in Python by hemant
• 5,810 points
1,420 views
0 votes
1 answer

I got expected an indented block error.

Hi, You used one function in your code, ...READ MORE

answered Jun 16, 2020 in Python by MD
• 95,060 points
953 views
0 votes
3 answers

i am installing wordcloud using pip but i am unable to do that ....i am getting the following error

Hi @ Prajwala  All the members here, I ...READ MORE

answered Sep 14, 2020 in Python by Richa sharma
3,663 views