Future Vision BIE Future Vision BIE


ONE STOP FOR ALL STUDY MATERIALS & LAB PROGRAMS


E MENU Whatsapp Share Join Telegram, to get Instant Updates
×

NOTE!

Click on MENU to Browse between Subjects...

Advertisement

17CS664 - PYTHON APPLICATION PROGRAMMING

Answer Script for Module 1

Solved Previous Year Question Paper

CBCS SCHEME


PYTHON APPLICATION PROGRAMMING

[As per Choice Based Credit System (CBCS) scheme]

(Effective from the academic year 2017 - 2018)

SEMESTER - VI

Subject Code 17CS664

IA Marks 40

Number of Lecture Hours/Week 3

Exam Marks 60




Advertisement

These Questions are being framed for helping the students in the "FINAL Exams" Only (Remember for Internals the Question Paper is set by your respective teachers). Questions may be repeated, just to show students how VTU can frame Questions.

- ADMIN




× CLICK ON THE QUESTIONS TO VIEW ANSWER

ANSWER :

11.1 Using Recursive:

Loading Image

Loading Image

11.2 Method 2 using Build-in Function

Loading Image

Loading Image



Advertisement

ANSWER :

12.1 Table with all methods of Strings:

Method

Description

capitalize()

Converts the first character to upper case

casefold()

Converts string into lower case

center()

Returns a centered string

count()

Returns the number of times a specified value occurs in a string

encode()

Returns an encoded version of the string

endswith()

Returns true if the string ends with the specified value

expandtabs()

Sets the tab size of the string

find()

Searches the string for a specified value and returns the position of where it was found

format()

Formats specified values in a string

format_map()

Formats specified values in a string

index()

Searches the string for a specified value and returns the position of where it was found

isalnum()

Returns True if all characters in the string are alphanumeric

isalpha()

Returns True if all characters in the string are in the alphabet

isdecimal()

Returns True if all characters in the string are decimals

isdigit()

Returns True if all characters in the string are digits

isidentifier()

Returns True if the string is an identifier

islower()

Returns True if all characters in the string are lower case

isnumeric()

Returns True if all characters in the string are numeric

isprintable()

Returns True if all characters in the string are printable

isspace()

Returns True if all characters in the string are whitespaces

istitle()

Returns True if the string follows the rules of a title

isupper()

Returns True if all characters in the string are upper case

join()

Joins the elements of an iterable to the end of the string

ljust()

Returns a left justified version of the string

lower()

Converts a string into lower case

lstrip()

Returns a left trim version of the string

maketrans()

Returns a translation table to be used in translations

partition()

Returns a tuple where the string is parted into three parts

replace()

Returns a string where a specified value is replaced with a specified value

rfind()

Searches the string for a specified value and returns the last position of where it was found

rindex()

Searches the string for a specified value and returns the last position of where it was found

rjust()

Returns a right justified version of the string

rpartition()

Returns a tuple where the string is parted into three parts

rsplit()

Splits the string at the specified separator, and returns a list

rstrip()

Returns a right trim version of the string

split()

Splits the string at the specified separator, and returns a list

splitlines()

Splits the string at line breaks and returns a list

startswith()

Returns true if the string starts with the specified value

strip()

Returns a trimmed version of the string

swapcase()

Swaps cases, lower case becomes upper case and vice versa

title()

Converts the first character of each word to upper case

translate()

Returns a translated string

upper()

Converts a string into upper case

zfill()

Fills the string with a specified number of 0 values at the beginning

12.2 Six Methods with Examples:

12.2.1 Capitalize:

Definition and Usage:

The capitalize() method returns a string where the first character is upper case.

Syntax:

string.capitalize()

Parameter Values:

No parameters

12.2.2 String center() Method

Definition and Usage

The center() method will center align the string, using a specified character (space is default) as the fill character.

Syntax

string.center(length, character)

Parameter Values:

Parameter

Description

length

Required. The length of the returned string

character

Optional. The character to fill the missing space on each side. Default is " " (space)

12.2.3 String count() Method

Definition and Usage

The count() method returns the number of times a specified value appears in the string.

Syntax

string.count(value, start, end)

Parameter Values

Parameter

Description

value

Required. A String. The string to value to search for

start

Optional. An Integer. The position to start the search. Default is 0

end

Optional. An Integer. The position to end the search. Default is the end of the string

12.2.4 String find() Method

Definition and Usage

The find() method finds the first occurrence of the specified value.

The find() method returns -1 if the value is not found.

The find() method is almost the same as the index() method, the only difference is that the index() method raises an exception if the value is not found. (See example below)

Syntax

string.find(value, start, end)

Parameter Values

Parameter

Description

value

Required. The value to search for

start

Optional. Where to start the search. Default is 0

end

Optional. Where to end the search. Default is to the end of the string

12.2.5 String isdigit() Method

Definition and Usage

The isdigit() method returns True if all the characters are digits, otherwise False.

Exponents, like ², are also considered to be a digit.

Syntax

string.isdigit()

Parameter Values

No parameters.

12.2.6 String lower() Method

Definition and Usage

The lower() method returns a string where all characters are lower case.

Symbols and Numbers are ignored.

Syntax

string.lower()

Parameter Values

No parameters

12.3 Program Demonstrating all the six methods:

Loading Image

Loading Image


ANSWER :

13.1 While & for loop:

Refer 1st & 4th Question & Answer or Click Here

13.2 FIBONACCI:

FIBONACCI

FIBONACCI Output



Advertisement

ANSWER :

14.1 Continue:

Continue is also a loop control statement just like the break statement. continue statement is opposite to that of break statement, instead of terminating the loop, it forces to execute the next iteration of the loop.

As the name suggests the continue statement forces the loop to continue or execute the next iteration. When the continue statement is executed in the loop, the code inside the loop following the continue statement will be skipped and the next iteration of the loop will begin.

14.2 Program:

Loading Image

Loading Image


ANSWER :

15.1 Refer 3rd Question & Answer or Click Here

15.2 Refer 12th Question & Answer or Click Here


× NOTE: Each Page Provides only 5 Questions & Answer
Below Page NAVIGATION Links are Provided...
All the Questions on Question Bank Is SOLVED

Advertisement

lIKE OUR CONTENT SUPPORT US BY FOLLOWING US ON INSTAGRAM : @futurevisionbie

For immediate Notification Join the Telegram Channel



× SUGGESTION: SHARE WITH ALL THE STUDENTS AND FRIENDS -ADMIN