Problem 1: Find output for each expression below: No 1. 2. 3. Expression 1 def take_power (integer1, integer2=2): T 2 3- 4 5 6 7 8 9 result = 1 for i in range(integer 2): result result * integer1 print (result) take_power (4) take_power (2,5) 1 2 3 4 5 6 7 print (result) def add_numbers (n1, n2): result = n1 + n2 add_numbers (2, 5) a = 10 b = 20 1 2 3 4 def define(): Y 5 global b b = 4 6 7 8 def add(): Y 9 c = a + b print(c) 10 11 12 13 add() 14 print (b) define() Output

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

(python questions)

 

4.
5.
6.
7.
8.
1 def Equation(a,b=2, c=3):
R= a*b + c
2
3
4
5
6
7 Equation (2,3)
8 Equation (c=1, a=1,b=2)
a
print(" result of a+2b-c is", R)
Equation (2)
Equation (2,1,1)
1- def fun_1():
2
print("Hello fun_1")
3
4- def fun_2():
5
f = fun_1()
print(f)
6
7
8 fun_2()
1 def Equation(a,b=2, c=3):
2
3
4
5 Equation (2)
R=a+2*b-c
print(" result of a+2b-c is", R)
1 def fun(a,b=2, c):
2
R= a*b**3
3
print(" result of a+2b-c is",R)
4
5
fun (2)
1 import math
2 number = 1.2
3 print (math.pow(number, 2))
4 print (round (number))
5
print(math.ceil(number+4))
6 print (math.floor (number-3))
Transcribed Image Text:4. 5. 6. 7. 8. 1 def Equation(a,b=2, c=3): R= a*b + c 2 3 4 5 6 7 Equation (2,3) 8 Equation (c=1, a=1,b=2) a print(" result of a+2b-c is", R) Equation (2) Equation (2,1,1) 1- def fun_1(): 2 print("Hello fun_1") 3 4- def fun_2(): 5 f = fun_1() print(f) 6 7 8 fun_2() 1 def Equation(a,b=2, c=3): 2 3 4 5 Equation (2) R=a+2*b-c print(" result of a+2b-c is", R) 1 def fun(a,b=2, c): 2 R= a*b**3 3 print(" result of a+2b-c is",R) 4 5 fun (2) 1 import math 2 number = 1.2 3 print (math.pow(number, 2)) 4 print (round (number)) 5 print(math.ceil(number+4)) 6 print (math.floor (number-3))
Problem 1: Find output for each expression below:
No
1.
2.
3.
Expression
1- def take_power (integer1, integer2=2):
2
3-
4
5
6
7
8
take_power (4)
9 take_power (2,5)
result = 1
for i in range(integer 2):
result result * integer1
print (result)
def add_numbers(n1, n2):
1
2
3
4
5
6
7 print (result)
result = n1 + n2
add_numbers (2, 5)
1 a = 10
2 b = 20
3
4- def define():
5
6
7
8 def add():
9
global b
b = 4
c = a + b
print(c)
10
11
12 define()
13 add()
14 print (b)
Output
Transcribed Image Text:Problem 1: Find output for each expression below: No 1. 2. 3. Expression 1- def take_power (integer1, integer2=2): 2 3- 4 5 6 7 8 take_power (4) 9 take_power (2,5) result = 1 for i in range(integer 2): result result * integer1 print (result) def add_numbers(n1, n2): 1 2 3 4 5 6 7 print (result) result = n1 + n2 add_numbers (2, 5) 1 a = 10 2 b = 20 3 4- def define(): 5 6 7 8 def add(): 9 global b b = 4 c = a + b print(c) 10 11 12 define() 13 add() 14 print (b) Output
Expert Solution
steps

Step by step

Solved in 4 steps with 8 images

Blurred answer
Knowledge Booster
Returning value from Function
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education