Python Learning
5.92K subscribers
451 photos
1 video
63 files
109 links
Python Coding resources, Cheat Sheets & Quizzes! πŸ§‘β€πŸ’»

Free courses: @bigdataspecialist

@datascience_bds
@github_repositories_bds
@coding_interview_preparation
@tech_news_bds

DMCA: @disclosure_bds

Contact: @mldatascientist
Download Telegram
The format function, when applied on a string returns ___________
Anonymous Quiz
28%
Error
9%
imt
10%
bool
53%
str
What will be the output of the β€œhello” +1+2+3?
Anonymous Quiz
39%
hello123
8%
hello
39%
Error
14%
hello6
What will be displayed by print(ord(β€˜b’) – ord(β€˜a’))?
Anonymous Quiz
18%
0
57%
1
22%
-1
3%
2
πŸ‘5❀1
Say s=”hello” what will be the return value of type(s)?
Anonymous Quiz
4%
int
9%
bool
59%
str
28%
String
πŸ‘4
To retrieve the character at index 3 from string s=”Hello” what command do we execute (multiple answers allowed)?
Anonymous Quiz
18%
s[]
36%
s.getitem(3)
26%
s.__getitem__(3)
20%
s.getItem(3)
❀1
To return the length of string s what command do we execute?
Anonymous Quiz
44%
len(s) OR s.__len__()
43%
len(s) only
7%
size(s)
7%
s.size()
πŸ‘1
Explanation:
len(s) is a built-in function in Python to get the length of the string s, whereas s.len() calls the len method of the string object s. It’s less common but functionally equivalent to len(s). So, we can use either of these.
To check whether string s1 contains another string s2, use ________
Anonymous Quiz
30%
s1.__contains__(s2)
32%
s2 in s1
32%
s1.contains(s2)
πŸ‘4
What will be the output of the following Python code?
print("abc DEF".capitalize())
Anonymous Quiz
7%
abc def
59%
ABC DEF
20%
Abc def
14%
Abc Def
What will be the output of the following Python code?
print("abc. DEF".capitalize())
Anonymous Quiz
7%
abc. def
38%
ABC. DEF
32%
Abc. def
22%
Abc. Def
🀯2
What will be the output of the following Python code?
print("abcdef".center())
Anonymous Quiz
43%
cd
23%
abcde
24%
error
9%
none
❀3πŸ‘1
What will be the output of the following Python code?

print("abcdef".center(0))
Anonymous Quiz
27%
cd
26%
abcdef
34%
error
12%
None
What will be the output of the following Python code?
print('*', "abcdef".center(7), '*')
Anonymous Quiz
37%
* abcdef *
46%
*abcdef *
17%
* abcdef*
What will be the output of the following Python code?

print('*', "abcdef".center(7), '*', sep='')
Anonymous Quiz
32%
* abcdef *
35%
* abcdef *
21%
*abcdef *
12%
* abcdef*
❀1
What will be the output of the following Python code?

print("abcdef".center(7, 1))
Anonymous Quiz
23%
1abcdef
40%
abcdef1
12%
abcdef
25%
error
πŸ‘2
What will be the output of the following Python code?

print("abcdef".center(7, '1'))
Anonymous Quiz
18%
1abcdef
43%
abcdef1
8%
abcdef
31%
error
πŸ‘2
What will be the output of the following Python code?

print("abcdef".center(10, '12'))
Anonymous Quiz
43%
12abcdef12
21%
abcdef1212
12%
1212abcdef
23%
error
🀯2
What will be the output of the following Python code?
print("xyyzxyzxzxyy".count('yy'))
Anonymous Quiz
62%
2
8%
0
25%
error
5%
none
πŸ‘3
What will be the output of the following Python code?

print("xyyzxyzxzxyy".count('yy', 1))
Anonymous Quiz
42%
2
15%
0
33%
1
11%
none
What will be the output of the following Python code?
print("xyyzxyzxzxyy".count('yy', 2))
Anonymous Quiz
44%
2
14%
0
32%
1
10%
none
πŸ‘1πŸ€”1