#πŸ”’ Need help about the string thing

63 messages Β· Page 1 of 1 (latest)

tropic elbow
#

print("Welcome to the RD Bank")
Name:input("Enter your full name:")
Loan:input("How much loan would you like to take:")
print(f"Hello {Name} your loan of
{Loan} is due on 09/08/24" )

novel cipherBOT
#

@tropic elbow

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.

tropic elbow
#

This still shows up

lean gorge
#

your syntax isn't quite right here. you need to assign variables using =, not :

tropic elbow
#

Ok

tropic elbow
lean gorge
#

show the latest code

tropic elbow
#

print("Welcome to the RD Bank")
Name=input("Enter your full name:")
Loan=input("How much loan would you like to take(The number of your loan should have at least 3 d.p):")
print(f"Hello {Name} your loan of
{Loan} is due on 09/08/24" )

ivory bane
tropic elbow
#

Bruh

#

Silly mistake

crude cosmos
#

python variables are single-line, you can't press enter while writing them. Instead you put a new line character: \n

tropic elbow
#

But thx

tropic elbow
#

I appreciate all of y’all’s help

crude cosmos
#

So like that:py print("Welcome to the RD Bank") Name=input("Enter your full name:") Loan=input("How much loan would you like to take(The number of your loan should have at least 3 d.p):") print(f"Hello {Name} your loan of\n{Loan} is due on 09/08/24")

#

No problem!

crude cosmos
#

What version of python do you have?

tropic elbow
#

Let me check

lean gorge
#

you can run this in a file to easily check

tropic elbow
#

4.5.334156

#

I use this app called β€œprogramiz”

crude cosmos
#

That's not python's version, latest python is 3.12

tropic elbow
#

Welp

#

It is what it is.

crude cosmos
tropic elbow
#

This shows up

lean gorge
#

that's not a good sign, haha

tropic elbow
#

Like I said-

#

It is what it is.

crude cosmos
#

this app seems, let's just say, not great

lean gorge
#

The error above then is likely because you're using an older version of python that doesn't support f-string

crude cosmos
#

yeah, that would be very old

lean gorge
#

you can use str.format instead

tropic elbow
#

I used it multiple times

lean gorge
lean gorge
tropic elbow
#

Wait

#

price=245.566
print(f"Your price is ${price:.2f}")

lean gorge
#

Show us the code that was erroring

tropic elbow
#

Btw if I suddenly stop responding then that means my power went out

tropic elbow
#

print("Welcome to the RD Bank")
Name=input("Enter your full name:")
Loan=input("How much loan would you like to take(The number of your loan should have at least 3 d.p):")
print(f"Hello {Name} your loan of \n{Loan:.2f} is due on 09/08/24" )

novel cipherBOT
#

Hey @tropic elbow!

It looks like you're trying to paste code into this channel.

Discord has support for Markdown, which allows you to post code with full syntax highlighting. Please use these whenever you paste code, as this helps improve the legibility and makes it easier for us to help you.

To do this, use the following method:
```py
print('Hello, world!')
```

This will result in the following:

print('Hello, world!')```
You can **edit your original message** to correct your code block.
tropic elbow
lean gorge
#

your Loan variable is a str

#

do you understand str and int and float?

tropic elbow
#

Yes

#

Ur the one who taught me

lean gorge
#

oh lol

#

You can't use :.2f on a string

#

you have to convert it first

tropic elbow
#

Ok

novel cipherBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, 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.