#๐Ÿ”’ emoticons to emojis

84 messages ยท Page 1 of 1 (latest)

dense latchBOT
#

@wanton swan

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.

thorny obsidian
#

And what is this supposed to do ?

molten path
#

Do you know how to write an if else statement?

wanton swan
#

def main():
name = input("Write something ")
convert(name)

def convert():
name = name.replace(":)", (smile_emoji))
name = name.replace(":(", (frown_emoji))
print(name)

main()

dense latchBOT
#

Hey @wanton swan!

Please edit your message to use a code block

```py
print('Hello, world!')
```

This will result in the following:

print('Hello, world!')```
wanton swan
#

this iis the newest

wanton swan
#

but its telling me

#

convert(name)

#

isnt workiing

molten path
#

Because your convert() is not taking any arguments

#

There is nothing in the parameters

wanton swan
#

thats hard to understand

molten path
#

Here's an example:

def greet(name):
  print("Hello ", name)

vs

def greet():
  print("Hello ", name)
#

Notice the difference?

wanton swan
#

theres name in there but

#

how does that help

molten path
wanton swan
#

there terminal doesnt know what name is ?

#

and i have to type so he knows what name is ?

molten path
wanton swan
#

what are you saying

#

im confused sorry

molten path
wanton swan
#

theres greet(name)

#

in first and in the second greet()

molten path
#

That's right

wanton swan
#

yes but what does it do

molten path
#

the name inside the greet(name) is called a parameter

#

So we can say greet function has a parameter called name

#

Without it, the inside of the function doesn't know what name is

wanton swan
#

yes

#

now i understand

#

but now terminal

#

stopping on this

#

how do i fix it

#

(smile_emoji)

#

doesnt work

#

nor (frown_emoji)

molten path
wanton swan
#

so

#

what it should be is this emoji ๐Ÿ™‚

#

can ii just put this emoji

#

in my script ?

molten path
# wanton swan stopping on this

When you say "stopping on this", you have to read what the error message says. It is not all gibberish. It gives you useful hint at why it stopped

wanton swan
#

i know it says

#

its not defined

#

but i dont understand

#

should i use emoji

#

or this text (smile_emoji)

molten path
# wanton swan but i dont understand

When something is not defined, it expects it defined before that line, like a variable. But in your case, you don't need a variable defined. You just need a string

wanton swan
#

it can still work like this right ?

#

"๐Ÿ™‚"

molten path
#

Emojis can be a string but you need to understand how strings are interpreted in Python

molten path
wanton swan
#

is there any other way

#

to do it with

#

just text ?

molten path
#

You have to remember and understand that strings in Python can only be interpreted within double quotes " or single quotes '

wanton swan
#

anyway thanks for help man

#

i really appreciate it

#

and also

#

is there a way

molten path
wanton swan
#

to find things easy in docs ?

molten path
#

Thats by design

molten path
#

I read docs everyday

#

I get used to it

wanton swan
#

what if i use

#

ctrl f

#

and then type

#

things im looking for

#

that can still work right ?

molten path
#

Definitely. Use the built-in search bar if it has one

#

That's where I find online docs more useful than printed hardcopy docs

wanton swan
#

trying to solve this for more than hour

dense latchBOT
#
Python help channel closed using Discord native close action

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.