Загрузка...

Python MCQ 159 - Walrus Operator, Test Your Skills#pythonprogramming#pythoninterview#shorts#trending

#python
#pythonprogramming
Python MCQ Questions and answers,
Python MCQ , Python Programming,
Python, python string,
string indexing, string slicing,
string function upper(),
string function capitalize(),
walrus operator, walrus,
assignment expression, named expression,
assignment expression in slicing,
walrus operator in slicing
evaluation of assignment expression,
evaluation of walrus expression,

PCAP Exam Essentials, PCAP Essentials,
PCAP Exam Hacks, PCAP Mock Exam,

**********--------------------------***********
💁
📜 *Assignment Expression/Walrus Operator :=*
→ Assigns the value of evaluated expression to perform intended operation and allows to use the value further. 👉 MCQ 155 - 158
🎯When used in slicing 👉 MCQ:61
⇒ *Enclose the expression within ()*
👉 Shorts: *String - Indexing, Slicing - Quick Reference*
*s.upper()* →Returns all chars of string s to upper case
*s.capitalize()* →Returns first char of string s to upper case, remaining to lowecase

💁‍♂️
s→'WelcoME'
🎯 p = s[:(m:=len(s)//2):].upper()
m:=len(s)//2
*Performs 2 operations*
1)⇒assigns the evaluated expression value to m
→len(s)//2→7//2→3⇒m = 3⏰
2)⇒uses the value as stop for slicing⇒s[:3:]
s[:3:]→Slices chars from index 0 to 2⇒'Wel'
'Wel'.upper()→Changes all chars to upper case
⇒p = 'WEL'

🎯q = s[m::].capitalize() 🤔 *m gets value used in p*
→s[3::]→Slices chars from index 3 to end⇒'coME'
'coME'.capitalize()→Changes first char to upper case, remaining to lowecase
⇒q = 'Come'
print(p+q)→concatenates p,q and prints
→'WEL'+'Come'⇒WELCome

**********--------------------------***********

NIELIT M3-R5 Course 'O' Level Certification,
PG TRB, TRB AP,
TN TRB Assistant Professor Computer Science,
TN TRB AP Computer Science,
GATE - Data Analytics, GATE - DA,
UGC NET, TANCET MCA, TN SET,

#pythondictionary #pythonfunctions #userdefinedfunction
#pythontutorial #pythonforbeginners #pythonlists
#pythonlist #pythonhacks #pythondictionaries

#pythondeveloper #pythoncoding #learnpython
#pythonquiz #python3 #pythonskills #codingpython
#pythonbasics #pythonbeginner #pythonprogramming
#datascience #dataanalytics

#codingquiz #quizchallenge #codingcommunity
#freshers #techtalk #top10
#interviewpreparation #interviewhacks #interviewquestions #interviewskills

Ace your Python exams with this MCQ marathon!
Covers various Python concepts, including input/output, data structures, and more.
#PythonMCQs #PythonInterview #CodingQuiz #PythonProgramming #TechSkills

#ssitlecturestamil ‎@ssitlecturestamilதமிழ் 

Видео Python MCQ 159 - Walrus Operator, Test Your Skills#pythonprogramming#pythoninterview#shorts#trending канала SS IT Lectures Tamil தமிழ்
Яндекс.Метрика
Все заметки Новая заметка Страницу в заметки
Страницу в закладки Мои закладки
На информационно-развлекательном портале SALDA.WS применяются cookie-файлы. Нажимая кнопку Принять, вы подтверждаете свое согласие на их использование.
О CookiesНапомнить позжеПринять