Open navigation menu
Close suggestions
Search
Search
en
Change Language
Upload
Sign in
Sign in
Download free for days
0 ratings
0% found this document useful (0 votes)
22 views
Chapter 3 Solved Problem
Uploaded by
shrishailmahajan81
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
Download now
Download
Save Chapter 3 Solved Problem For Later
Download
Save
Save Chapter 3 Solved Problem For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
0 ratings
0% found this document useful (0 votes)
22 views
Chapter 3 Solved Problem
Uploaded by
shrishailmahajan81
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
Download now
Download
Save Chapter 3 Solved Problem For Later
Carousel Previous
Carousel Next
Save
Save Chapter 3 Solved Problem For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
Download now
Download
You are on page 1
/ 8
Search
Fullscreen
: sisson Fencton beer et proce onc cal remanneggy arene y Pomme = Fantom Bo xen Man pre yes 1. def power(b, 9) TE A local variable having the same name as that of 2 global variable. hides the function, |OTE © Anewers for OTOs are given at the end of the book. ‘Solved Problem 1 What i the significance of having fonctions in a program ? Sofstion. Creating functions in programs is very useful and used when needed in other programs. the program code given bel, identify the parts mentioned below ef processtumber(x): x=72 return x+3 y=58 processnunber(y) body, main ee on heer, anction call arguments, parameters function‘solution. @ eee eaeessorst 2S. 0 eS eee 5 ee ee ; yon cde astra 4 global ota celal 1a oo ble and global variable are as iin | evar is variable wt ones A Tris accessible throughout theSolution. The reson for unelected changes inthe main program is that although both aiuin program aed sei) have variables trthsame names‘ x andy, but tei scopes arent shownin the adjacent igure print(res) Solution Global names 15 ind en def caln(): flobal a anis b=20 print(a) 4 the above program will be able to swap the values of variables through sw ee? Passing parameter is redundant)COMPUTER SciNC 165, lowing code? Compare and comment on thefllowing to return statements ‘The return statement is optional ONLY WHEN the function i vid or we can say that when the function does not return a value. A function that returns a value, must have atleast one return statement, ‘snot returning any value, rather it returns the contol to caller along with empty value None. And. the statement return val returning the control to caller alng withthe vale contained in variablesTa Weal cio it ua os ge eee Suton ‘ef getones(oun): ‘return the oe onesbigit «nun return onesosgit kites fncton tt ries en ela aera 7 ia, inary ant exec puns of the integer nu Please recall hat bin() and hex) donot return um cquivalent numbers in binary and hexadecimal number spe of variables? How can you acess a glbal variable inside TCBSE Sample Pape 2019-29]COMPUTER ScitNCE yp co Find Total for in args (1, meer #3) tion calls 2 a eet reat ew emo fe Une erg your reference. "| 1 af 2 a + 5 ‘ 7 ‘ 3 ones Sse elceeret”) a print(result) fonction return? ‘5. What wil be the output of following programs ? 0 nme def mya): return print oun) pri(ofurt)) print(nm) mane ef myfunc(): 14691 integer and prints the number that follows ater it. Call te flow of execution fr both the Daw a bt s 6 a 2 %. w 4, 12, print(sum(a, b, c,4), Length(), mean(a, b, c, d)) a iment and calculates cube for it The function does not 18. Draw flow of execution for above program, i eee to the function in function call, the function should 1. Inthe following code, which variables are in the same scope ? et finest): be able to print three numbers randomly. string arguments and checks whether they are same-length strings ess false). (ceturns True in thi ee ll ll152 6. ba . Write a program that generates a series using a function which takes first and last values of COMPUTER SCIENCE wiry . PTH, Write a function namely nthRoot( ) that receives two parameters x and n and returns nth 1 TOot Oe xm, The default value of n is 2. _ Write a function that takes a number and then returns a randomly generated number havin 8 digits (not starting with zero) e.g., if nis 2 then function can randomly return a number 10-99 Say, etc. are not valid two digit numbers. but Write a function that takes two numbers and returns the number that has minimum one’s [For example, if numbers passed are 491 and 278, then the function wi minimum one’s digit out of two given numbers (491’s 1 is < 278's 8 digit return 491 because it has ot and then generates four terms that are equidistant e.g., if two numbers passed are 1 and 7 nal returns 1357.
You might also like
Functions HW
PDF
No ratings yet
Functions HW
6 pages
Python Function Questions
PDF
No ratings yet
Python Function Questions
13 pages
Worksheet 2
PDF
No ratings yet
Worksheet 2
10 pages
Chapter 6 Solution PDF
PDF
No ratings yet
Chapter 6 Solution PDF
7 pages
UNIT-3
PDF
No ratings yet
UNIT-3
10 pages
Chapter 6 Function - Combined
PDF
No ratings yet
Chapter 6 Function - Combined
44 pages
Working With Functions
PDF
No ratings yet
Working With Functions
22 pages
Python Unit 2
PDF
No ratings yet
Python Unit 2
25 pages
Home Test CSANSKEY
PDF
No ratings yet
Home Test CSANSKEY
6 pages
CHAPTER-3-working The Functions-Notes
PDF
No ratings yet
CHAPTER-3-working The Functions-Notes
23 pages
Chapter 7
PDF
No ratings yet
Chapter 7
18 pages
GR 12 CH 3 Working With Functions Notes
PDF
No ratings yet
GR 12 CH 3 Working With Functions Notes
16 pages
Functions in Python Class Notes
PDF
No ratings yet
Functions in Python Class Notes
9 pages
FUNCTIONS-Q&A
PDF
No ratings yet
FUNCTIONS-Q&A
11 pages
Python Functions 1
PDF
100% (1)
Python Functions 1
49 pages
Chapter - 3 Notes
PDF
No ratings yet
Chapter - 3 Notes
11 pages
Unit. 3. L-6,7,8
PDF
No ratings yet
Unit. 3. L-6,7,8
12 pages
Adobe Scan 16 Apr 2024
PDF
No ratings yet
Adobe Scan 16 Apr 2024
4 pages
Function Type B Cs
PDF
No ratings yet
Function Type B Cs
12 pages
1 Funtions
PDF
No ratings yet
1 Funtions
52 pages
04 Functions
PDF
No ratings yet
04 Functions
43 pages
FN All Imp Qus
PDF
No ratings yet
FN All Imp Qus
10 pages
FoP Ch03 Functions
PDF
No ratings yet
FoP Ch03 Functions
44 pages
Unit 4.1 Python Functions
PDF
No ratings yet
Unit 4.1 Python Functions
26 pages
publication_3_5798_6270
PDF
No ratings yet
publication_3_5798_6270
8 pages
Chapter 3 - Type B - Application Based Questions
PDF
No ratings yet
Chapter 3 - Type B - Application Based Questions
8 pages
function_wk
PDF
No ratings yet
function_wk
4 pages
Notes - Working With Functions
PDF
No ratings yet
Notes - Working With Functions
13 pages
Assignment 2 FUNCTIONS
PDF
No ratings yet
Assignment 2 FUNCTIONS
6 pages
Lab-10 Functions in Python: Objectives
PDF
No ratings yet
Lab-10 Functions in Python: Objectives
7 pages
ICT Lecture 26 28 (Functions)
PDF
No ratings yet
ICT Lecture 26 28 (Functions)
18 pages
Cs Assingment
PDF
No ratings yet
Cs Assingment
9 pages
Working With Functions Xii Output Questions
PDF
50% (2)
Working With Functions Xii Output Questions
7 pages
Python Unit 2
PDF
No ratings yet
Python Unit 2
14 pages
Working With Functions-2 2022-23
PDF
No ratings yet
Working With Functions-2 2022-23
55 pages
Dhanwin
PDF
No ratings yet
Dhanwin
13 pages
Function and Recursion of Python
PDF
No ratings yet
Function and Recursion of Python
42 pages
Functionlec
PDF
No ratings yet
Functionlec
18 pages
XII - CS_Revision Tour
PDF
No ratings yet
XII - CS_Revision Tour
16 pages
Chapter 5 PythonFunctions
PDF
No ratings yet
Chapter 5 PythonFunctions
49 pages
Chapter 6
PDF
No ratings yet
Chapter 6
24 pages
A4黑白散打
PDF
No ratings yet
A4黑白散打
6 pages
UIS 20200504 Classwork 62832 1
PDF
No ratings yet
UIS 20200504 Classwork 62832 1
10 pages
XII-CS(CHAPTER123)
PDF
No ratings yet
XII-CS(CHAPTER123)
3 pages
Chapter 5 part 1 pfe
PDF
No ratings yet
Chapter 5 part 1 pfe
30 pages
XII CS CHAPTER 7 & 8 - NOTES
PDF
No ratings yet
XII CS CHAPTER 7 & 8 - NOTES
13 pages
03a Functions
PDF
No ratings yet
03a Functions
23 pages
CCD_Module15-PL101_01
PDF
No ratings yet
CCD_Module15-PL101_01
12 pages
12CS em 2024
PDF
No ratings yet
12CS em 2024
152 pages
Lecture1 Functions
PDF
No ratings yet
Lecture1 Functions
10 pages
Programming Essentials in Python
PDF
No ratings yet
Programming Essentials in Python
23 pages
Class Test Function
PDF
No ratings yet
Class Test Function
3 pages
Python Funtions
PDF
No ratings yet
Python Funtions
40 pages
Functions
PDF
No ratings yet
Functions
9 pages
Module 2 - 2
PDF
No ratings yet
Module 2 - 2
45 pages
Working with functions
PDF
No ratings yet
Working with functions
25 pages
VTU Exam Question Paper With Solution of BPLCK105B Introduction To Python Programming May-2023-Dr.M.Farida Begam Tamal Sarkar, DR - Vakula Rani, Vijay Anand, Shyamali Das
PDF
100% (1)
VTU Exam Question Paper With Solution of BPLCK105B Introduction To Python Programming May-2023-Dr.M.Farida Begam Tamal Sarkar, DR - Vakula Rani, Vijay Anand, Shyamali Das
31 pages
SDF-Week13
PDF
No ratings yet
SDF-Week13
15 pages
CH 3 Function
PDF
No ratings yet
CH 3 Function
31 pages
Chapter 4
PDF
No ratings yet
Chapter 4
18 pages
Current Electriciry
PDF
No ratings yet
Current Electriciry
54 pages
Unit 3 Computer Networks
PDF
No ratings yet
Unit 3 Computer Networks
98 pages
SQLTABLE2223
PDF
No ratings yet
SQLTABLE2223
49 pages
Pysql 2223
PDF
No ratings yet
Pysql 2223
12 pages
Project of Shri
PDF
No ratings yet
Project of Shri
30 pages
Jaat
PDF
No ratings yet
Jaat
1 page
PGG GEHI COMP XI L
PDF
No ratings yet
PGG GEHI COMP XI L
22 pages
Chapter 3 Class11 (2023-24) Motion in Straight Line
PDF
No ratings yet
Chapter 3 Class11 (2023-24) Motion in Straight Line
45 pages