Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def display():
- print("Funtion")
- print("Inside the Function")
- display()
- def calcSum(x, y):
- total = x + y
- print(total)
- calcSum(3, 4)
- calcSum(10, 20)
- def show_local():
- x = 10
- print(x)
- y = x * 2
- print(y)
- show_local()
- def calc():
- x = 10
- y = 5
- return x, y
- y, x = calc()
- print(y, x)
- ############################
- def factorial(n):
- fac = 1
- for number in range(1, n+1):
- fac = fac * number
- return fac
- result = factorial(10)
- keepGoing = "yes"
- while keepGoing == "yes":
- number = eval(input("number: "))
- keepGoing = input("Enter yes to continue: ")
- number = eval(input("Enter a positive number or 0 to stop: "))
- while number != 0:
- print(number)
- number = eval(input("Enter a positive number or 0 to stop: "))
- def calcSum():
- keepGoing = "yes"
- total = 0
- while keepGoing == "yes":
- num = eval(input("Enter a number: "))
- total = num + num
- keepGoing = input("Enter yes to continue: ")
- return total
- total = calcSum()
- print(total)
- def findMax():
- maxValue = 0
- number = eval(input("Enter a positive number or 0 to quit: "))
- while number != 0:
- if number > maxValue:
- maxValue = number
- number = eval(input("Enter a positive number or 0 to quit: "))
- return maxValue
- total = findMax()
- print(total)
- import math
- def area(radius):
- result = math.pi * radius ** 2
- return result
- import random
- def randomNumber():
- countEven = 0
- coundOdd = 0
- for time in range(100):
- x = random.randint(10, 20)
- if x % 2 == 0:
- countEven += 1
- else:
- countOdd += 1
- return countEven, countOdd
- x, y = randomNumber()
- print(x,y)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement