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 28, 2020 by Gitika 3,569 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,460 points

Related Questions In Python

+2 votes
9 answers

Python error "IndentationError: expected an indented block"

Python requires its code to be indented ...READ MORE

answered Jun 17, 2019 in Python by Varun

edited Jun 17, 2019 324,330 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 21, 2020 in Python by anonymous
• 65,770 points
1,095 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,230 points
1,056 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 7, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 4,464 views
0 votes
1 answer
+5 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,790 points
4,125 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,460 points
2,531 views
0 votes
3 answers

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

word cloud is not supported for python ...READ MORE

answered Apr 15, 2020 in Python by anonymous
33,170 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP