What's new

# HelpPYTHON Dictionaries

Comment

#### notoriouz

##### Enthusiast
salamat paps..bago lang kasi ako sa dictionaries
nalito din ako jan dati

Comment

#### Ech iY uri

pa help po gusto ko din malaman yung coding. saan po makakahanap ng dictionary ng ganyan?

Comment

Comment

#### PHC rem

##### Honorary Poster
pa help po gusto ko din malaman yung coding. saan po makakahanap ng dictionary ng ganyan?
hirap nga hanapin paps e..hinahanap ko din..para ma tutunan ko

Comment

#### Ech iY uri

hirap nga hanapin paps e..hinahanap ko din..para ma tutunan ko
mero naman sa p.s pero. html yun

Comment

#### PHC rem

##### Honorary Poster
pede din ganto dinagdag lang

fruit = item
cost = fruits[item]

para mas maganda pangalan ng variable

View attachment 723620
paps alam mo ba to?..hirap na hirap nako.hahaha

The idea here is to see how many years it will take a bank account to grow to at least a given value, assuming a fixed annual interest. Write a program savings.py. Prompt the user for three numbers: an initial balance, the annual percentage for interest as a decimal, like .04 for 4%, and the final balance desired.
All the monetary amounts that you print should be rounded to exactly two decimal places. Start by printing the initial balance this way. For example, if the initial balance was entered as 123.5, it should be reprinted by your program as 123.50. Also print the balance each year until the desired amount is reached or passed. The first balance at or past the target should be the last one printed.
The math: The amount next year is the amount now times (1 + interest fraction), so if I have \$500 now and the interest rate is .04, I have \$500*(1.04) = \$520 after one year and after two years I have, \$520*(1.04) = \$540.80....
For example, if I respond to the prompts, and enter into the program a \$500 starting balance, .04 interest rate and a target of \$550, the program prints:

500.00
520.00
540.80
562.43

Comment

#### notoriouz

##### Enthusiast
, Last edited:
paps alam mo ba to?..hirap na hirap nako.hahaha

The idea here is to see how many years it will take a bank account to grow to at least a given value, assuming a fixed annual interest. Write a program savings.py. Prompt the user for three numbers: an initial balance, the annual percentage for interest as a decimal, like .04 for 4%, and the final balance desired.
All the monetary amounts that you print should be rounded to exactly two decimal places. Start by printing the initial balance this way. For example, if the initial balance was entered as 123.5, it should be reprinted by your program as 123.50. Also print the balance each year until the desired amount is reached or passed. The first balance at or past the target should be the last one printed.
The math: The amount next year is the amount now times (1 + interest fraction), so if I have \$500 now and the interest rate is .04, I have \$500*(1.04) = \$520 after one year and after two years I have, \$520*(1.04) = \$540.80....
For example, if I respond to the prompts, and enter into the program a \$500 starting balance, .04 interest rate and a target of \$550, the program prints:

500.00
520.00
540.80
562.43
madali lang yan paps tignan mo lang sa formula at gamitan ng logic

enter initial amount -> enter growth -> enter target

-> while initial amount < target -> perform the formula

-> if initial amount is >= to target -> break Comment

#### PHC rem

##### Honorary Poster
madali lang yan paps tignan mo lang sa formula at gamitan ng logic

enter initial amount -> enter growth -> enter target

-> while initial amount < target -> perform the formula

-> if initial amount is >= to target -> break

View attachment 723980
asan po yong formula paps?

Comment

#### PHC rem

##### Honorary Poster
madali lang yan paps tignan mo lang sa formula at gamitan ng logic

enter initial amount -> enter growth -> enter target

-> while initial amount < target -> perform the formula

-> if initial amount is >= to target -> break

View attachment 723980
paps bat pag nag input ako ng 550 sa target amount
ayaw tumigil ng loop.

#CASE STUDY
in_amount = float(input("Enter Initial Amount: "))
annual_grow = float(input("Enter Annual Growth: "))
target_amount = float(input("Enter Target Amount: "))

while in_amount < target_amount:
rate = 1 + annual_grow
total = (in_amount * rate)
totals = total * rate
print("Initial Amount: {}".format(in_amount))
print("Year 1: {}".format(total))
print("Year 2: {}".format(totals))
print("Year 3: {}".format(totals * rate))
if totals >= target_amount:
break

Comment

#### notoriouz

##### Enthusiast
, Last edited:
-sa pagdeclare ng annual_grow + 1
-dagdag ka variable na year = 1
-print mo yung initial amount bago mag loop
-in_amount *= annual_grow
-print year and in_amount
-year += 1
-condition and break

Comment

#### notoriouz

##### Enthusiast
, Last edited:
paps bat pag nag input ako ng 550 sa target amount
ayaw tumigil ng loop.

#CASE STUDY
in_amount = float(input("Enter Initial Amount: "))
annual_grow = float(input("Enter Annual Growth: "))
target_amount = float(input("Enter Target Amount: "))

while in_amount < target_amount:
rate = 1 + annual_grow
total = (in_amount * rate)
totals = total * rate
print("Initial Amount: {}".format(in_amount))
print("Year 1: {}".format(total))
print("Year 2: {}".format(totals))
print("Year 3: {}".format(totals * rate))
if totals >= target_amount:
break
dalawang print lang kelangan jan at yung formula simplehan mo lang para di ka malito,
wag ka na mag declare ng kung ano ano

di na kelangan ideclare yung formula at isang line lang yun

Comment

#### PHC rem

##### Honorary Poster
dalawang print lang kelangan jan at yung formula simplehan mo lang para di ka malito,
wag ka na mag declare ng kung ano ano

di na kelangan ideclare yung formula at isang line lang yun
#CASE STUDY
in_amount = float(input("Enter Initial Amount: "))
annual_grow = float(input("Enter Annual Growth: "))
target_amount = float(input("Enter Target Amount: "))

rate = annual_grow + 1
year = 1

print("Initial Amount: {}".format(in_amount))
while in_amount < target_amount:
in_amount *= rate
print("Year",year,":",in_amount)
year += 1
if in_amount >= target_amount:
break

thank you paps..nakuha ko na

Comment

#### PHC rem

##### Honorary Poster
dalawang print lang kelangan jan at yung formula simplehan mo lang para di ka malito,
wag ka na mag declare ng kung ano ano

di na kelangan ideclare yung formula at isang line lang yun
my book kaba ng python paps?

Comment

#### notoriouz

##### Enthusiast
my book kaba ng python paps?
di ako nagbook eh tamang search lang haha

Comment

#### PHC rem

##### Honorary Poster
di ako nagbook eh tamang search lang haha

Comment

#### notoriouz

##### Enthusiast

• homer_simpson and PHC rem
Comment

Members online
1,558
Guests online
922
Total visitors
2,480