How to call functions inside a function in Python?

Python 3.2 how to call a function into another?

  • def sigmageo(): ...print("geometric sigma") ...print(""" ... ...Sn = G1(1-r^n) ... .............--------- ... ...............1-r ...""" ... ..) ...r1 = float(input("common ratio: ")) ...gn = float(input("# of terms adding or the term you want to figure out the value of: ")) ...g1 = float(input("First term: ")) ...a = (g1*(1-pow(r1, gn)))/(1-(r1)) ...print("the",gn,"term you wanted = ",a) ...input("") def geometseq(): ...print("geometric sequence") ...print(""" ... ...Gn = G1 * r^(n-1) ...""" ...) ...Gn = float(input("the term you want the value of: ")) ...G1 = float(input("the first term: ")) ...r2 = float(input("common ratio: ")) ...n = Gn ...Gn = G1 * pow(r2, n-1) ...print(n,"is equal to",Gn) ------------------ how do i call the bottom function into the top function? and how do i call functions into other functions in general??

  • Answer:

    post this code to somewhere it is readable like codepad or pastebin. All the periods are making it confusing to read. I know they mean tabs and I can find the tabs, but this is nearly unreadable. Also, I don't see where you call either function from the other.

Jared Garrow at Yahoo! Answers Visit the source

Was this solution helpful to you?

Other answers

post this code to somewhere it is readable like codepad or pastebin. All the periods are making it confusing to read. I know they mean tabs and I can find the tabs, but this is nearly unreadable. Also, I don't see where you call either function from the other.

Jared

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.