Get Ahead with Our Exam Q&A

Explore our extensive collection of questions and answers to enhance your learning experience and prepare for exams effectively

count() returns the number of occurrences, e.g., ‘aaa’.count(‘a’) = 3.

isalpha() returns True if all characters are alphabetic, e.g., ‘text’.

strip() removes leading and trailing whitespace, e.g., ‘ text ‘.strip() = ‘text’.

capitalize() returns ‘Python’, capitalizing the first letter only.

split() divides a string, e.g., ‘a,b’.split(‘,’) = [‘a’, ‘b’].

.format(‘Python’) replaces {0} with ‘Python’, outputting ‘Hello Python’.

endswith() checks if a string ends with a specified suffix, e.g., ‘file.txt’.endswith(‘.txt’) is True.

title() capitalizes each word, resulting in ‘Python’.

float(‘3.14’) converts the string to a float, resulting in 3.14.

floor() from math module returns the floor, e.g., math.floor(3.7) = 3.

Entri Contact Image

Get Expert Advice for Free: Register for Your Free Consultation Now!

    [honeypot honeypot-100]