732077447 by Unknown

732077447 by Unknown

Author:Unknown
Language: eng
Format: epub


global x

x = math.gcd (m,n)

def rs(n):

y = math.exp(n)

print ("The value of e raised to exponent is:",x)

def main():

print ("Select function from menu by choosing the number of your choice.
")

print ("1. Finding GCD
")

print ("2. Finding E raised to power
")

print ("
")

w =int(input("Please enter the menu number and hit enter:
"))

if (w == 1):

a=int(input("Please enter the first number to find GCD"))

b=int(input("Please enter the second number to find GCD"))

value= fc(a, b)

print ("The GCD value is:",x)

else:

main()

if w==2:

c =int(input("Please enter the number to raise e by")) value2 = rs(c)

This is the same example of the GCD and exponent with a menu. The difference here is that in the GCD function the x variable is now defined as global.

Thus, the print function has been moved from the function to the main function under the first if condition.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.