• best python institute in Delhi

    Pyhton Beigneer Guide


    Welcome Back Everyone in This Lecture. We're Going to Go over the Solutions for the Practice Problems That Were under Level 1. Let's Open up That You Brought a Notebook and Continue Ok.


    The First Problem Was This Old Macdonald Problem Where We Wanted You to Write a Function That Capitalises the First Four Letters of a Name, and There Are Two Different Ways We're Going to Show You How to Do This. One Is If the Capitalised Method and Then the Other Is the above Method.digital marketing company


    We Haven't Shown You the Capitalised Method yet Except We Added a Note Here That Basically What Capitalised Does Is It Grabs an Entire String in Other Cases the First Letter in That String. best institute for machine learning So Let's Do First with the Upper and Then We'll Show You How to Do with Capitalise. First, We Want to Grab the First Letter. So I'm Going to Say the First Letter Is Equal to Name Zero. python and machinree And Then I Want to Grab the Characters in Between. So We'll Call These In-between Characters. best python course


    And Those Are Going to Go from Name Index One up to Let's Say Index Three and Then We Want to Grab the Fourth Letter. So Say the Fourth Letter Names Index Three. And Then Finally the Rest Is Going to Be Named from Index Four Onwards.seo services So Let's See If This Works, We're Going to Return the First Letter with In-between with the Fourth Letter plus Rest.

     

    So Let's See If We Get the Same Result There. Ok. So Good We Get Back. Mcdonald Now Want to Do Is Uppercase the First Letter, and Then I Want to Uppercase the Fourth Letter, and Then We Run This. We Get Back. Mcdonald so This Is How You Could Do This with Uppercase Using Just Indexing and Slicing You Separated Uppercase What You Need and Then Concatenate It Back Together Again. But You Can Also Do This with the Capitalised Method, and the Capitalised Method Is Going to like to Do Fewer Slices. So What We Could Do Is Separated into Two Halves.


    so Say the First Half of the Name Is Going to Be from Name from the Beginning to Index 3. So It's Going to Be the Mack Part and the Rest of It. That Second Half. A

    6

     

    nd It's Not Really an Even Half I Should Say Probably Second Part Is Going to Be from Three All the Way to the End and Then All We Could Do Is the Following a Can Say First Half and Instead of Calling Upper I'm Going to Call Capitalize and Then I Will Concatenate That with the Second Half and Capitalize That in Our We Run This. We Get Back the Same Results. Say You Could Use the Capitalised Method Instead of the above Method.

     

    •  and Basically What That Does Is It Grabs Two Strings This Lowercase Mack and This Lowercase Donald and Upper Cases the First Letter or Character in Those Substrings and Then Concatenate Them Together.         
    • So It's the Old Macdonald Shown Two Different Ways. Next, best python institute in Delhi    We Have Master Yoda Where We're given a Sentence We Want to Return a Sentence with the Words Reversed. 
    • So to Do This, We Need to Do a Couple of Things First to Get a List of the Words. So We're Already Quite Familiar with That. Now We Can Say Wordlist Is Equal to Text Dot Split. And Now I Need to Reverse This List Somehow. And We Know Various Methods of Doing That. 
    • why python course in important 
    •  
    • So Let Me Show You What I Mean. I'm Going to Say the Text. Split Is the Word List, and Then I'm Going to Slice the Wordless Insteps from the Beginning to the End in a Negative One. And That's Going to Be the Reversed Wordlist. Whoops. 
    • Let's Make Sure We Don't Use a Keyword There. Reverse Wordlist and Let's Return the Reverse Wordlist and See What Happens. So Notice Here I Get Back Home Am I. And Then with Master Yoda I Get Back. Ready Are We. 
    • Now We Do Want an Actual String Instead of the List Itself to Join This List. We Can Use a Method Called Join a String. So Let Me Create a Couple of Cells Here the Way You Can Explain How the Join Method Works.
    •  In Case You Haven't Seen It Before Let's Imagine to Have a List Here of a String a B and C.
    • . I Don't Want to Join This Together, so I'll Call This My List. Well,


    you End up Doing as You Create a String. You're Going to Have a String of Toothaches and Then Offer the String You Say Join. And Then You Pass My List. And What This Does Is It Takes the String You Have Here, and It's Going to Use It to Concatenate as a Fill-in Between. Every Item in the List.

     

    If I Just Have a Space Here It Puts a Space Between a B and C If I Have Maybe a Bunch of O's Then It's Going to Put a Bunch of Rows in Between a B and C

    So a Lot of times When You Want to Join Things Together Such as Words on a List You Can Either Have It as an Empty String Just a Blank String to Single Quotes Right next to Each Other Abc or You Can Have Space Here and It Joins to Get the Other a Space Bc. So to Get This Back as a String Sentence What It Could Do Is Fine. Instead of Just Saying Reverse Wordlist I Could Say Single Quote Space Single Quote Join the Reverse Word List. And Now When I Run This, I Get Back the Original String Itself. Home Am I. And Then Ready,

    source :https://www.techstack.in/machine-learning

     

    Are We? So That's the Introduction to the Join Method. In Case You Haven't Seen It Before. Finally, We're Going to Discuss the Almost There, and That Was given an Integer N Return True and Is Within 1 10 of Either 100 or 200.best digital marketing institute in delhi

    So the Way We Can Do That Is by Taking Note of Abs. So Abs Return the Absolute Value of a Number. So We're Going to Return and Check for the Following. We Want to Check If 100 minus and the Absolute Value of That Is Less than or Equal to 10. So We Want to Check That, but We Also Want to Check Another Situation.

    you can also watch here https://www.youtube.com/watch?v=LzHc7VC5bfA

    So We're Going to Raptus Princes to Kind of State That's One Thing We're Checking or Want to Check If the Absolute Value Between 200 and an Is Less than or Equal to 10. And Then Finally We Can Return This. So We're Just Checking Hey Is 100 minus Number the Absolute Value of That. The Difference Between That Number and 100 Is That Less Equal to 10. Or Is the Difference Between That Number and 200 Lessner Equal to 10. And We Run This. We Get Back the Correct Results. So This Is False. This Was True,

     

    and Then This One Is Also True. Ok. That's the Basics. Level 1 Introduces a Couple of Things Here Mainly the Common Method and the Absolute Value Function in the Very next Lecture. We're Going to Go over the Level Two Problems We'll See.

     

    All Posts
    ×