#๐ emoticons to emojis
84 messages ยท Page 1 of 1 (latest)
@wanton swan
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.
And what is this supposed to do ?
Do you know how to write an if else statement?
no
def main():
name = input("Write something ")
convert(name)
def convert():
name = name.replace(":)", (smile_emoji))
name = name.replace(":(", (frown_emoji))
print(name)
main()
Hey @wanton swan!
```py
print('Hello, world!')
```
This will result in the following:
print('Hello, world!')```
this iis the newest
Yeah that should work
Because your convert() is not taking any arguments
There is nothing in the parameters
Here's an example:
def greet(name):
print("Hello ", name)
vs
def greet():
print("Hello ", name)
Notice the difference?
Where is the name in where?
there terminal doesnt know what name is ?
and i have to type so he knows what name is ?
type name in where?
What is the difference between these 2 functions? @wanton swan
That's right
yes but what does it do
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
yes
now i understand
but now terminal
stopping on this
how do i fix it
(smile_emoji)
doesnt work
nor (frown_emoji)
Is that supposed to be a variable or a string?
so
what it should be is this emoji ๐
can ii just put this emoji
in my script ?
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
i know it says
its not defined
but i dont understand
should i use emoji
or this text (smile_emoji)
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
Emojis can be a string but you need to understand how strings are interpreted in Python
Like that, yes
You have to remember and understand that strings in Python can only be interpreted within double quotes " or single quotes '
yes i know
anyway thanks for help man
i really appreciate it
and also
is there a way
If its just text without the quotes, thats a variable
to find things easy in docs ?
Thats by design
Just read them I guess. To each their own
I read docs everyday
I get used to it
what if i use
ctrl f
and then type
things im looking for
that can still work right ?
Definitely. Use the built-in search bar if it has one
That's where I find online docs more useful than printed hardcopy docs
thanks for help man
trying to solve this for more than hour
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.