#Currency Converter in Python

1 messages · Page 1 of 1 (latest)

stable temple
#

I’m not sure if I square root pesos soles and reais

ionic flax
obtuse salmon
#

What's the point of using sqrthere?

stable temple
#

Idk

#

Cheshire told me to so I been doing it

#

I got my last answer using it

obtuse salmon
#

Have you read the task on the left?

stable temple
#

Yes

#

I did everything correctly

#

Besides one thing

#

I square rooted but I don’t think I am supposed to because I got an different answer

#

They got 89.6 and I got 5607.97

rough totem
#

@stable temple Please use descriptive thread titles. Also, you don't need to create a new thread for every question you have

obtuse salmon
#

Where does it mention square roots

rough totem
stable temple
#

But I assumed it was square root because my last question was square root

#

Which was this

obtuse salmon
#

Can you like

#

Actually read the exercise you're doing

stable temple
obtuse salmon
obtuse salmon
rough totem
#

!format python

azure flaxBOT
#
Code Formatting

When sharing code with the community, please use the correct formatting for ease of readability.

Example

```python
YOUR CODE HERE
```

Those are back ticks not single quotes, typically the key above TAB

stable temple
rough totem
#

Please use code blocks for small pieces of code, and screenshot the instructions

#

Reading a photo of a screen is very difficult

obtuse salmon
stable temple
obtuse salmon
#

You have X in currency Y
Make thing that asks the user how much he has
Google current exchange rate
Calculate value of shit currency in USD

stable temple
#

Yeah not anymore that I broke it down

rough totem
#

Currency Converter in Python

ionic flax
obtuse salmon
stable temple
#

How do I google the exchange rates

obtuse salmon
#

Serious question

stable temple
#

Ik it’s not a dumb question to ask

#

But 15

obtuse salmon
ionic flax
obtuse salmon
#

hard work

stable temple
#

So I type Colombian pesos exchange rate ?

#

I’m confused

stable temple
obtuse salmon
ionic flax
#

have you never used a search engine before?

obtuse salmon
#

Idk why I am even in here still

#

I'm really questioning reality right now

stable temple
#

My bad, they don’t teach us about exchange rates in school, so I’m not sure how I would search it

obtuse salmon
stable temple
#

Yes

ionic flax
#

the same way you search for literally anything else on google. you put in the thing you want to know about

stable temple
#

Found it

#

$1 usd = 0.92 euro

obtuse salmon
stable temple
#

Ik

#

So 3,918.52 for each usd dollar

#

Right ?

ionic flax
#

well what does the website say

#

we aren't going to do the reading or the thinking for you

stable temple
#

I’m making sure I’m correct before I move on to the next step

obtuse salmon
#

Fuck do I know about these shithole currencies 😭

#

looks about right tho

stable temple
#

Okay thx

#

So do I put 5600 in the peso currency box ?

ionic flax
#

to do what?

stable temple
#

Because back to the problem , it says what do you have left in pesos , and they say 5600

ionic flax
#

I'm not able to read the problem, you've only pasted it as a small image

stable temple
ionic flax
#

how would typing 5600 into google help you do that

stable temple
#

I don’t know that’s why I’m asking for help😭

ionic flax
#

think first

stable temple
#

I did and that got me no where

ionic flax
#

figure out what you need to do before you try to do it

obtuse salmon
#

X * Y = Z
X = USD amount
Y = how many usd for each Z
Z = shit currency amount

ionic flax
#

we will not be a wall for you to throw guesses at and see what sticks

obtuse salmon
#

solve for X

stable temple
#

so do i divide x by y?

#

to get z

ionic flax
#

jfc have you ever taken a math class

obtuse salmon
stable temple
#

x=1.43

#

y=5600

#

(columbian pesos)

#

wait

#

y=3916

#

my bad i didnt get it at first i get it now

#

$1 for each 3917 in pesos

#

and $1.43 for each 5600 pesos

#

now that i got that what do i do next ? @obtuse salmon

#

Nevermind I look slow now 🤦‍♂️ but I got the answer now I have to convert the foreign currency’s to usd dollar

obtuse salmon
#

😎

stable temple
#

But why did I get an error

#

i entered 1.43 because thats what it is in usd

#

but it didnt go through

#

and i know im correct because i wrriten the problem down paper but im off by 3 but its because the currency value couldve changed since they made this website

#

i got 86.26 on paper and they got 89.6

#

but when i plug it in on computer i get error idk why

iron mortar
#

you use float

#

not int

#

cause its an float not an int

#

@stable temple

stable temple
#

Okay Thankyou

#

How would I put a float in , do I remove int ?

#

@iron mortar

rough totem
#

You will limit your learning if you're afraid to experiment yourself. You cannot always be asking people to hold your hand while you code

stable temple
#

Okay thx for the advice , I’m going to try

iron mortar
stable temple
#

Yes it worked

stable temple
rough totem
#

That means you learnt something!

stable temple
#

Yeah I had some notes written down earlier I just went back to it remembered float means a decimal number

#

not the exact same answer but close enough!

rough totem
#

Wait what?

stable temple
#

The currency value changed in usd since this website came out

#

That’s why it’s not the same answer

#

@rough totem

rough totem
#

Your code doesnt even do the conversion tho

stable temple
#

Wym , how not ?

#

I did the conversion part on paper

rough totem
#

?????

#

Your program is supposed to do that

#

Otherwise all you've done is created an addition calculator

stable temple
#

It says google the exchange rate

rough totem
#

😐

stable temple
#

So what did I do wrong

rough totem
#

Your program needs to do the conversion for the user

stable temple
#

No it isn’t

iron mortar
#

it is according to what u said

stable temple
#

It says calculate the “total” in USD

rough totem
stable temple
#

I might be wrong

rough totem
#

You are wrong

stable temple
#

But how would I do that

#

I spent a hour doing a whole bunch of nothing 🤦‍♂️😭

iron mortar
#

then you have to use fetch/requests from the current currency

stable temple
#

What’s fetch request

rough totem
iron mortar
#

rate

rough totem
#

But they don't need to do a request to any website or api

#

It's supposed to be a simple beginner exercise

stable temple
#

So I code , 5600 pesos=(int)1.43?

rough totem
#

????

stable temple
#

Wait not int

#

My bad

#

5600 pesos=(float) 1.43

#

?

rough totem
#

I wonder if you think things through

stable temple
#

I do its I’m just overwhelmed by a lot of this stuff because this is kind of my first day trying to code myself

#

Yesterday was just me taking notes

simple zenith
#

If I have 10 pesos, how much do I have in USD?

#

@stable temple

stable temple
#

0.0026

simple zenith
#

Can you calculate it in python?

#

Like can you write the code to do it in python?

stable temple
#

So you’re saying can I convert 10usd to pesos in python ?

simple zenith
#

10 pesos to usd

stable temple
#

Yeah , okay let me see

#

Int(10 pesos)=float (0.0026 )

#

?

simple zenith
#

uh...no

#

how did you calculate it in your head?

stable temple
#

I didn’t calculate in my head , I used google

#

It told me to

simple zenith
#

How would you do it if I told you something is worth $10 and I have 5 of them. What's the total value that I have?

stable temple
#

50

#

10x5

simple zenith
#

yes

#

so you would do the same in python

#

pesos are worth 0.00025 usd and I have 10 of them

stable temple
#

0.0025?

simple zenith
#

yes but how would you write the code in python to calculate it for you

stable temple
#

10 *0.00025

simple zenith
#

yup

#

Now, what if I told you I have 15, 25, 67, 123? or an n number of pesos? where n is the input by the user. How would you calculate it?

stable temple
#

N is the variable right ?

#

n*

#

I’m sorry I’m confused

#

I don’t think codedex taught me how to do that yet

#

@simple zenith

simple zenith
stable temple
#

I don’t know how to calculate it , I might I just don’t understand in this method

simple zenith
#

n * 0.00025

stable temple
#

So what do I do with 15 , 35, 67 , 123?

simple zenith
#

n is any number of pesos. it can be 15, 35, 67, 123 or whatever the user enters

stable temple
#

Ohh

#

The other numbers just threw me off my bad

simple zenith
#

Do you get how to do it now?

stable temple
#

No I’m confused still but I got the answer because I got frustrated and looked at the solution

total = pesos * 0.00025 + soles * 0.28 reais * 0.21

#

But I don’t get where they got that from

simple zenith
#

got what from?

stable temple
#

The whole line

#

I don’t know why I’m typing it in

#

I’m confused

simple zenith
#

Do you understand the problem?

stable temple
#

Mostly

simple zenith
#

what is it asking you to do?

stable temple
#

It’s asking me to create a program that ask the user for the amount they have in pesos , soles , and reais and the calculated the total in usd

simple zenith
#

yes so the numbers that you see in that line are the conversion rates

stable temple
#

Ohhhh

#

See I get it now , I just didn’t know why I was typing that in

#

but i got the wrong answer

#

Never mind

#

Got it

#

@simple zenith I have one last question

#

Where did I get 0.00025 , 0.28 , 0.21 from ?

simple zenith
sleek tendon
#

I didn't tell you to square root for this problem....
The last problem you did was to calculate hypotenuse using a formula which contained square root. You used square root because that's part of the formula to calculate the hypotenuse.
This problem is for currency conversion, which is a different problem.
You have to think about the problem you are trying to solve - don't just use square root because it solved the last problem - think about WHY you used it in the last problem. Think about what math is involved in THIS problem.