#🔒 How do I use an if?

59 messages · Page 1 of 1 (latest)

raw girder
#

I’m trying to make a calculator.

vivid birchBOT
#

@raw girder

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

delicate iris
#

Generally:

if some condition here:
    thing to do if it is true
else:
    thing to do if it is false

You can omit the else: part.

#

So the condition will test something you're interested in.

raw girder
#

What am I doing wrong here?

delicate iris
#

Ah, the test for equality is spelled == (2 equals) not =, which is for assignment.

raw girder
#

Oh

#

So now I have another issue

#

There’s a white box that just deletes everything

delicate iris
#

Can you be more detailed?

raw girder
#

When I push space it dissapears

delicate iris
#

It looks like some odd typing mode. Can you not just type the missing stuff out again?

#

I assume you cant run discord directly on that PC?

raw girder
#

When I try to use “” I can’t get in between without deleting one of the “

#

I have discord on that pc

delicate iris
#

Try a left or right arrow key?

delicate iris
raw girder
#

So it just goes between the two “ and never goes in between

#

I’ll copy and paste

#

Discord is currently loading up

delicate iris
raw girder
#

When I use left and right arrows and try to type something in I can never type in the space between the white bar only goes onto the “”

versed canyon
#

num1 = int(input("First number(s)"))
num2 = int(input("Second number(s)?"))
op = input("What are we doing?")
if op == ""

raw girder
#

That’s the copy and paste

delicate iris
#

You can't just type if op == "+": ?
Is something autotyping the second quote or something?

raw girder
#

I’ll just screen record it.

raw girder
delicate iris
#

No. What's that?

raw girder
#

A recording app

delicate iris
#

Oh

raw girder
#

The arrows don’t work

delicate iris
#

Oh. Just type when the block is over the scond quote symbol.

#

What happens if you do that?

raw girder
#

The second one just gets deleted

#

And it gets replaced by what I typed

delicate iris
#

Oh. Maybe you're in some "overwirte" mod, instead of the more usualy "insert text" mode. Does pressing ESC turn off the block?

raw girder
#

No

#

I figured out the issue

delicate iris
#

When did the white block appear? What had you just typed?

#

Oh yay. What is it?

raw girder
#

It was smth called mdv

#

Idk what is that.

delicate iris
#

Me either.

raw girder
#

Thanks!

delicate iris
#

Things working now? If statement ok?

raw girder
#

Yea

#

Ima keep this open in case I need more help

raw girder
#

@delicate iris How do I input a division symbol?

delicate iris
#

Just type a forward slash /

#

If you want the dot-above-and-blow-horizontal-line I'm not sure.

#

If you want the dotty thing in a line, try \U{DIVISION SIGN} in the string, eg:

"\U{DIVISION SIGN}"
#

Sorry, \N not \U
the N is for "name".

>>> "\N{DIVISION SIGN}"
'÷'
#

@raw girder ^

raw girder
#

Oh thanks!

#

!solved

vivid birchBOT
#
Python help channel closed with !close

This help channel has been closed. Feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.