String 08 PDF

Title String 08
Author mohamed ijas pakeeh
Course Civil Engineering
Institution South Eastern University of Sri Lanka
Pages 8
File Size 604.6 KB
File Type PDF
Total Downloads 20
Total Views 142

Summary

Download String 08 PDF


Description

CE 13001 – Introduction to Computing

Chapter Name: Lab Session(Strings) Assingment

: 08

Faculty of Engineering South Eastern university of Sri Lanka

Name

: I.M.I.PAKEEH

Registration No : SEU/IS/ 18/EG/055 Semester

: 01

Submission Date : 09-06-2020

Statements >>>fruit= ‘banana’ >>>letter=fruit[1] >>>print(letter)

>>>fruit=’banana’ >>>letter=fruit[0] >>>print(letter)

Answer

Explanation for the answer a

Statements >>>Fruit=’banana’ >>>fruit[ :3]

Answer

>>>fruit[3: ]

‘ana’

>>>fruit[3:3]

‘ ‘

>>>len(fruit[3:3])

0

>>>fruit[ : ]

‘banana’

‘ban’

Explanation f It returns the beginning to of the string I returns thir fourth letter third index to her are no st Between this string leters. No starting o

Statements >>>fruit=’banana’ >>>’bingo’< fruit >>>’pineapple’>>word=’banana’ >>>new_word=word.upper() >>>print(new_word)

BANANA

>>>Word=’banana’ >>>Index=word.find(‘a’) >>>Print(index) >>>word.find(‘na’) >>>word.find(‘na’,3) >>>line 1=’ **Her we go** ‘ >>>line1.strip() >>>line2=’Have a nice day’ >>>line2.startswith(‘Have’)

2 4 ‘**Here we go**’

>>>line.startswith(‘h’)

False

>>>line.lower().startswith(‘h’)

Explanation for the answer Upper function change string letters to capital

1

True

The statement ‘Have a nice day’ starting with ‘Have’. So that’s true ‘Have a nice day doesn’t start with ‘h’. Name ‘line’ is not defined....


Similar Free PDFs