How can I loop my code so it will go up in increments?

C.Calzana

I want my code increase in increments each time it loops but I am unsure how to do it.How to I get it to repeat itself while increasing by $10, 10 times.

This is what I have so far:

def money():
amount = float(input("Enter NZ convertion amount:$ "))
AUD = amount*0.96
US = amount*0.75
Euro = amount*0.67
GBP = amount*0.496
print('NZ$', amount,'AUD: {}, US:{}, Euro: {}, GBP: {}'.format(AUD, US, Euro, GBP))
return
money()

any ideas?

nehem

Why don't you simply wrap the calculation and printing part into a 10 times for loop like this?

def money():
    amount_ = float(input("Enter NZ conversion amount:$ "))
    for i in range(1, 11):
        amount = amount_ * i
        AUD = amount*0.96
        US = amount*0.75
        Euro = amount*0.67
        GBP = amount*0.496
        print('NZ$', amount,'AUD: {}, US:{}, Euro: {}, GBP: {}'.format(AUD, US, Euro, GBP))
    return

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

how can i speed up my code?

From Dev

JAVA,how can I loop my code

From Dev

How can I mprove my code so that it can be more standard?

From Dev

How can I mprove my code so that it can be more standard?

From Dev

Beginner VBA for Excel: how can I speed up my code?

From Dev

How can I set it up so I can SSH into my VMWare guest VM?

From Dev

Where can I put ACTION_UP in my code so it works?

From Dev

How to I set up the for loop so I can select one radio button per question?

From Dev

How can I obfuscate my c# code, so it can't be deobfuscated so easily?

From Dev

How should I set up my dual-boot so that I can hibernate the secondary OS?

From Dev

How should I set up my bucket policy so I can deploy to S3?

From Dev

How can I see if my password variable is within a line so that my code can proceed?

From Dev

How can I optimize my code to answer the path numbers I can go from A to B?

From Dev

Can I use a loop to optimize my code?

From Dev

How can I loop my output so that all the results in my text file show?

From Dev

How can I change my following quick sort code so that I can use randomized pivot?

From Dev

How can I run a loop through 2 lists simultaneously so each item in the loops match up? [Python]

From Dev

How can I terminate netcat so my script can loop again?

From Dev

How can I wire up a button on my page so that it is clicked when a user presses enter?

From Dev

How can I modify the server date so that it lines up with the date of my users (8 hours ahead)

From Dev

How can I speed-up this loop?

From Dev

How can I set up a continuation of my Do...While... Loop (VBA)?

From Dev

How can I speed up my regex?

From Dev

How I can speed up my algorithm?

From Dev

How would I loop a randomly generated arithmetic 10 times over? this is my code so far

From Dev

how do I loop this code so I can add to the total cost value

From Dev

Can I configure Backblaze so that it backs up my application folder?

From Dev

How can I publish my project code online so someone can help me with it?

From Dev

How can I speed up this bit of code (loop/lists/tuple optimization)?

Related Related

  1. 1

    how can i speed up my code?

  2. 2

    JAVA,how can I loop my code

  3. 3

    How can I mprove my code so that it can be more standard?

  4. 4

    How can I mprove my code so that it can be more standard?

  5. 5

    Beginner VBA for Excel: how can I speed up my code?

  6. 6

    How can I set it up so I can SSH into my VMWare guest VM?

  7. 7

    Where can I put ACTION_UP in my code so it works?

  8. 8

    How to I set up the for loop so I can select one radio button per question?

  9. 9

    How can I obfuscate my c# code, so it can't be deobfuscated so easily?

  10. 10

    How should I set up my dual-boot so that I can hibernate the secondary OS?

  11. 11

    How should I set up my bucket policy so I can deploy to S3?

  12. 12

    How can I see if my password variable is within a line so that my code can proceed?

  13. 13

    How can I optimize my code to answer the path numbers I can go from A to B?

  14. 14

    Can I use a loop to optimize my code?

  15. 15

    How can I loop my output so that all the results in my text file show?

  16. 16

    How can I change my following quick sort code so that I can use randomized pivot?

  17. 17

    How can I run a loop through 2 lists simultaneously so each item in the loops match up? [Python]

  18. 18

    How can I terminate netcat so my script can loop again?

  19. 19

    How can I wire up a button on my page so that it is clicked when a user presses enter?

  20. 20

    How can I modify the server date so that it lines up with the date of my users (8 hours ahead)

  21. 21

    How can I speed-up this loop?

  22. 22

    How can I set up a continuation of my Do...While... Loop (VBA)?

  23. 23

    How can I speed up my regex?

  24. 24

    How I can speed up my algorithm?

  25. 25

    How would I loop a randomly generated arithmetic 10 times over? this is my code so far

  26. 26

    how do I loop this code so I can add to the total cost value

  27. 27

    Can I configure Backblaze so that it backs up my application folder?

  28. 28

    How can I publish my project code online so someone can help me with it?

  29. 29

    How can I speed up this bit of code (loop/lists/tuple optimization)?

HotTag

Archive