#!C:\Python26\python.exe # Three-times-the-square-root-of-your-age.py # # This is a python program that # will input the user's name and age # the output will be 3 times the # square root of the user's name # # author: Min Ku "Peter" Joo # last revision: 02/10/2010 import os import math def main ( ): sayWelcome ( ) getUsersName ( ) getUsersAge ( ) calThreeSqrtOfAge ( ) tellUserOutcome ( ) programPause ( ) def sayWelcome ( ): # Welcomes the user to the program print "Welcome to Peter's program." def getUsersName ( ): # asks the user for his or her full name usersFullName = raw_input ("What is your full name? " ) return usersFullName def getUsersAge ( ): # asks the user for his or her age usersAge = raw_input ("What is your age in whole numbers? ") return usersAge def calThreeSqrtOfAge ( ): #calculates three times the square root of user's age threeSqrtAge = 3*math.sqrt(usersAge) return threeSqrtAge def tellUserOutcome ( ): # informs user the outcome of 3 times the square root of his or her age print usersFullName, '3 times the square root of your age is:', threeSqrtAge def programPause ( ): raw_input ("This is the end of Peter's program. Press enter to exit the program.") if __name__ == '__main__': main()
how do i get assign variables to be used in other functions?
for example the age that the user inputs. how do i use that in both the function to get the age and the function to calculate 3*math.sqrt (age)