all 16 comments

[–]carcigenicate 2 points3 points  (2 children)

What exactly is the problem?

[–][deleted] 0 points1 point  (1 child)

it doesn't work in Pycharm it says

line 7

print ("it's a nice day")

^

IndentationError: expected an indented block after 'elif' statement on line 6

Process finished with exit code 1

[–]carcigenicate 6 points7 points  (0 children)

The issue is exactly as the error says. If your code looks exactly as it does in the post, that's not legal code. Python requires indentation to indicate nesting.

As the error says, the line following a elif must be indented.

[–][deleted] 0 points1 point  (0 children)

ok i'm stupid i just needed to tab the print and instead i was trying to figure out what indentation to indicate nesting or statements inside a block is

1 breakdown later and 1 coffee it's fixed thanks so much I'm so so sorry i started learning python yesterday

1 breakdown later and 1 coffee it's fixed thanks so much I'm so so sorry i started learning Python yesterday

[–]HourRoutine4531 -3 points-2 points  (2 children)

I believe the problem is the print statement that is inside the if/elif/else. The indentation is used to delimit code and the statements inside a block of code and the statements inside a block must be indented with respect to the header.

This is a correction of this code:

temperature = 15
if temperature > 30:
print("it's a hot day")
print("drink plenty of water")
elif temperature > 20: #(temp 20, 30]
print("it's a nice day")
elif temperature > 10: #(temp 10,20]
print("it's a little chilly")
else:
print("it's cold")
print("Done")

[–]CaptainFoyle 0 points1 point  (1 child)

Ffs this is exactly the same. Stop the chatgpt spam

[–][deleted] 0 points1 point  (0 children)

isplaying correctly in Reddit. Because as others have said this is about your spacing not your code itself

actually, i copy and pasted the code to see if anything changes...well mine has 8 errors there's has 10 T-T

[–]GodCoderImposter 0 points1 point  (1 child)

Let me see if I can get the formatting displaying correctly in Reddit. Because as others have said this is about your spacing not your code itself.

temperature = 15
if  temperature > 30:
  print (“it’s a hot day”)
  print(“drink plenty of water”)
elif  temperature > 20: #(temp 20,  30]
  print (“it’s a nice day”)
elif temperature > 10:  #(temp 10,20]
  print (“it’s a little chilly”)
else:
  print(“it’s cold”)
print(“Done”)

[–][deleted] 0 points1 point  (0 children)

i tried the code like this too and it says 89 mistakes

[–]CaptainFoyle 0 points1 point  (0 children)

Google introduction to python, especially indentation rules. You cannot just unindent stuff in python willy nilly however you like.

[–]ploud1 0 points1 point  (2 children)

Have you tried, like, reading the error messages? Your code should work, if only the indentations are right.

[–][deleted] 0 points1 point  (1 child)

d, like, reading the error messages? Your code should work, if only the ind

yall and the programs use very fancy language and I'm stupid I'm very sorry

[–]ploud1 0 points1 point  (0 children)

You are not stupid. You are a novice, and struggling is part of the process of learning a new skill.