You are on page 1of 10
De tnciongy-Ciien AdminApp File Et fomit_ Run Optons Window Hep #2 write the output of he following See" cati ono, on20) DB Pinon 74h Fle Eat shel Debug Options Window Help (apes) } on wins? Type "help", 300 @ 200 300 @ 100 [EB function py - C:/Users/Admin/AppData/Local/Programs/Python/Python3 File Edit Format Run Options Window Help # 2 wnat will che function recurn def addem(x,y,2) princ (x+y+z) DD Python 374 She File_Edt Shell Debug Options Window Python 3.7.4 (tags/v3.7.4:e09359 (AMDE4)) on win32 Type "help", "copyright", "credi = RESTART: C:/Users/Admin/AppDat ‘>>> addEm(1,2,3) é >>> UProgams/Python Pythons Muncionpy (74) Python 3.7.4 (eage/¥3.7.41e0935Sii2e, Jul = Neopyright®, eredice or "ice = RESTART! C1/Usere/namin/AppDaca/Local/Prog (B -tunction py - C/Users/Admin/AppDataLoca/Programs/Python/Py File dit Format Run Options Window Help # § wnat will the function return when called Gee adden (x, ¥,2)# revurn xévtz [TQ python 374 Shell print (x+y+z) File Edit Shell Debug Options Python 3.7.4 (tags/v3.7.: (AMDE4)] on win32 Type "help", "copyright", ‘ >> = RESTART: C:/Usere/adnin/ >>> addEm(4,5,6) as >> Bb fection py - Gytsers/ Acie pata Local Prosparre/ Python Python37 File Edt Format Run Options Window Help 4 € What will be the outpuc of following prosrans? ai te def myfunc (0+ retarn num TB Python 3.74 She File_Edit_ Shell Debug Options Window _H print (num) Python 3.7.4 (tags/v3.7.4:e08359112 print(myfunc()) | (ampe4)] on win32 print (num) Type “nelp", "copyright", "creaize’ >>> = RESTART: C:/Users/Admin/AppData/t DD function py -C/Users/Admin/AppDataLoca/Programs/Python/Python3? File Edit Format Run Options Window Help # 6 What will be the output of following programs? [Btunction py -G/Users/Admin/AppDsta/ oca/Programs/Python/ Python File Edt Format Run Options Window Help #2 : pee ee ioe ee ee ee per [B Python 3.74 She ¥ € Waat will be the output of following programs’ : #3 ——_—errrs det myfunet): | rie cat Shel Debug Options Window |tun = 1 BB ryton 74h Zecurn mum | Python 3.7.4 (tags/v3.7.47e093881 Sf RyFuNS (0: | rie Ege Shell_ Debug Options Window Hi peut (aa) (aND64)] on wins? global num Se in 4) on wi aon Kine ao [Pyeion 3.7.4 (caga/v3.7. 47009358112 Prine(myfunc()) |T¥Pe "Rep", "copyright", wcreaic.| MRT 10 | Gumeay] on winsa Print (num) >>> int’ (nun) [Type "help", “copyright, "credits! = RESTART: C:/Users/Admin/AppData, Princ ayzune()) |>>> : os + RESTART: C1/sez0/Aann/Repbece/t 10 2 to >>> aS [BD function py - C:/Users/Admin/AppData/Local/Programs/Python/Python37/funct File Edit Format Run a4 def display: display() print ("there!™) print ("Hello", end = * *) Options Window _Help # € What will be the output of following programs? UD Python 3.7.4 Shel File Edit Shell Debug Option Python 3.7.4 (rags/v3.7- (Ampe4)] on wins2 Type "help", “copyright” = RESTART: C:/Users/Aami Hello there >>> [B functionpy - C/Users/Admin/AppOata/Local Programs/Python/Python37unction.py (3.74) File Edit Format Run Options Window Help #10 and ii Consider the code below and answer the questions that follow? def multiply (numberi, number2) answer = number] "number? print (numeri, ‘time: evurn (answer) output = malesply(S,5) ‘number LB Python 3:74 Shel File_Edit_Shell_ Debug Options Window Help answer) Python 3.7.4 (tags/v3.7.4:e09358112e, Jul 8 2018, (ampe4)] on wins? ‘Type "help", “copyright”, “credits” or “License()* = RESTART: C:/Users/Admin/AppData/Local/Prograns/P 5S times S = 25 >>> [ “function.py - C:/Users/Admin/AppData/Local/Programs/Python/Python37/function.¢ File Edit Format Run Options Window Help # 16 Write a program with a function that takes an #integer and prints the number that follows after it: #Call the function with these arguments, def fun (x): 37. prine (x + 2) | Ed Pthon3.74spet File Edit Shell Debug Options Window Help fun (4) Python 3.7.4 (tags/v3.7.4:e083581i2e, Ju fun(8) (AMDE4)] on win32 fun (6) Type "help", "copyright", "credits" or " fun (241) >>> fun (4-342) = RESTART: C:/Users/Admin/AppData/Local/ fun (-3-2) 16 64 36 9 4 25 >>> #18 What is the output of fo (2) . + append((4]) | & print (L, ) Q. Write a program to have following function: (Da tunetion that takes a number as argument and calculates cube fort. The function dows not return €@ value. t1thore is no value passed tothe function in function call. the function should caleulate cube of (i) Atunetion that takos two char arguments and rturns Tru both the arguments are equal otherwise Fase ets ca Entor a number (For empty pross Enter) 9 29 Cube of © Entor a number (For empty pross Enter ) Cube of 2 Peas fours Pera oes econ aes ey eires)) Enter a Char: Path Enter a Char 2: Walla False Enter a Char1: Path Enter a Char 2: Path True Q. Write a function that receives two numbers and jenerates a random number from that range Using this ‘unction, the main program should be able to print three numbers randomly. eee on Q. Write a function that receives two string arguments and checks whether they are same-length strings (returns True in this case otherwise false). h(a, b) ee cCe Secu) pO ecu Oras Ura eC Gece ot Cua nd) Entor First String Python Enter Second String Portal True Enter First String ~Path Enter Second String - Walla Entor First String =ABCDE Enter Second String VWXYZ True Q. Write a function namely nthRoot QO that receives two parameters x and n and returns nth root of X**Y in. The default value of nis 2. Pee eee! CU eae) ee ae Re cd Sa ee) pty Enter 0 )=3 Q. Write a function that takes a number n and then returns ag randomly generated number having exactly n digits (not starting with zero) ed rae aes PCR Ca) eC hee) Ce ee ee) See ec aa at En of digit:2 Enter number of digit: F of digit: 5 $F of digit :10 Q.Write a function that takes two numbers and returns the number that has minimum one's digit. parry Pew ces cee cums Gate) int (i nter cea) Prete ene Cat first numb ond nu Minimum one's digit number = 4565 Q. Write a program that generates a series using a function which takes first and last values of the series and then generates four terms that are equidistant e.g., if two numbers passed are land 7 then function returns 13 57. a) eeu pues suis pC et eG cesta PU et GCs crag Term = ter last Term=8 Series= 24 100 m= 60 es = 100877460 st Te

You might also like