33 Python Tutorial for Beginners Function Arguments in Python
>> YOUR LINK HERE: ___ http://youtube.com/watch?v=ijXMGpoMkhQ
Check out our courses: • Java Full Stack and Spring AI - https://go.telusko.com/JavaSpringAI • Coupon: TELUSKO10 (10% Discount) • DevOps with AWS: From Basics to Mastery : https://go.telusko.com/DevOpsAWS • Coupon: TELUSKO10 (10% Discount) • Master Java Spring Development : https://go.telusko.com/masterjava • Coupon: TELUSKO20 (20% Discount) • Udemy Courses: • Spring: https://go.telusko.com/udemyteluskosp... • Java:- https://go.telusko.com/udemyteluskojava • Java Spring:- https://go.telusko.com/Udemyjavaspring • Java For Programmers:- https://go.telusko.com/javaProgrammers • Python : https://go.telusko.com/udemyteluskopy... • Git : https://go.telusko.com/udemyteluskogit • Docker : https://go.telusko.com/udemyteluskodo... • For More Queries WhatsApp or Call on : +919008963671 • website : https://courses.telusko.com/ • Instagram : / navinreddyofficial • Linkedin : / navinreddy20 • TELUSKO Android App : https://bit.ly/TeluskoApp • Discord : / discord • In this lecture we are discussing : • all variables are actually references to objects in memory. Thus, when a function is called with a parameter, the reference to the object is passed by value. • • For immutable data types like integers, floats, and strings, changes made to the parameter inside the function do not affect the original value of the parameter outside the function. This is because any changes made to the parameter create a new object in memory, and the original reference to the object remains unchanged. • • For mutable data types like lists and dictionaries, changes made to the parameter inside the function do affect the original value of the parameter outside the function. This is because the reference to the object remains the same, but the contents of the object can be modified. • def update(lst): • print(id(lst)) • • lst[1]=25 • print(id(lst)) • print( x ,lst) • • lst = [10,20,30] • print(id(lst)) • update(lst) • print(lst) • • The above code defines a Python function called update that takes a list lst as a parameter. The function first prints the memory address of the list using the id() function. It then modifies the second element of the list by assigning it the value 25. The function then prints the new memory address of the list and the updated list. • • The code then creates a list called lst with the values [10, 20, 30] and prints its memory address using the id() function. The update function is then called with the lst parameter. Since lists are mutable objects in Python, the memory address of the list is passed to the function, making it a pass by reference. • • Inside the update function, the second element of the list is modified to 25. Since lists are mutable objects and the memory address of the original list is passed to the function, this change affects the original list outside the function. The new memory address and the updated list are printed inside the function. • • Python Tutorial to learn Python programming with examples • Complete Python Tutorial for Beginners Playlist : • #1 Python Tutorial for Beginners | In... • Python Tutorial in Hindi : • #1 Python Tutorial | Introduction | I... • Github :- https://github.com/navinreddy20/Python- • Java and Spring Framework For beginners with Spring Boot : - http://bit.ly/3LDMj8D • Java Tutorial for Beginners (2023) :- http://bit.ly/3yARVbN • Editing Monitors : • https://amzn.to/2RfKWgL • https://amzn.to/2Q665JW • https://amzn.to/2OUP21a. • Subscribe to our other channel: • Navin Reddy : https://www.youtube.com/channel/UCxmk... • Telusko Hindi : • https://www.youtube.com/channel/UCitz... • • Donation: • PayPal Id : navinreddy20 • Patreon : navinreddy20 • http://www.telusko.com/contactus
#############################
