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
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.
The Secret History by Donna Tartt(18083)
The Social Justice Warrior Handbook by Lisa De Pasquale(11941)
Thirteen Reasons Why by Jay Asher(8416)
This Is How You Lose Her by Junot Diaz(6411)
Weapons of Math Destruction by Cathy O'Neil(5800)
Zero to One by Peter Thiel(5461)
Beartown by Fredrik Backman(5304)
The Myth of the Strong Leader by Archie Brown(5217)
The Fire Next Time by James Baldwin(4998)
How Democracies Die by Steven Levitsky & Daniel Ziblatt(4940)
Promise Me, Dad by Joe Biden(4899)
Stone's Rules by Roger Stone(4833)
100 Deadly Skills by Clint Emerson(4662)
Rise and Kill First by Ronen Bergman(4536)
A Higher Loyalty: Truth, Lies, and Leadership by James Comey(4532)
The David Icke Guide to the Global Conspiracy (and how to end it) by David Icke(4359)
Secrecy World by Jake Bernstein(4354)
The Farm by Tom Rob Smith(4305)
The Doomsday Machine by Daniel Ellsberg(4233)
