0% found this document useful (0 votes)
9 views5 pages

P 8

Uploaded by

hlemorvan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
9 views5 pages

P 8

Uploaded by

hlemorvan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 5
0471212028 10:14 Pylon Variables - Assign Multple Values v’ Tutorials Exercisesw Servicesey§ QO Login Python Variables - Assign Multiple Values [revs ] Le J Many Values to Multiple Variables Python allows you to assign values to multiple variables in one line: Example xX, y, Z = “Orange”, “Banana", “Cherry” print(x) print(y) print(z) Note: Make sure the number of variables matches the number of values, or else you will get an error. One Value to Multiple Variables hitps:vawawaschools.comipythonipython_variables_ multiple. asp us 0471212028 10:14 Pylon Variables - Assign Multple Values 3 w Tutorialsy —Exercisesw Servicese§ QO Log in schools creep x = y =z = “Orange” print(x) print(y) print(z) Unpack a Collection If you have a collection of values in a list, tuple etc. Python allows you to extract the values into variables. This is called unpacking. Example Unpack a list: fruits = ["apple", "banana", “cherry"] x, y, z= fruits print (x) print(y) print(z) Learn more about unpacking in our Unpack Tuples Chapter. hitps:vawawaschools.comipythonipython_variables_ multiple. asp 26 0471212028 10:14 Pylon Variables - Assign Multple Values Tutorials~ Exercisesw Serviesey§ QO SignUp Login CSS JAVASCRIPT SQL. PYTHON. «= JAVA. PHP, «=~ HOWTO—W3,CSS_—C Lear To Create Powerful, Dynamic Applications and Web’ Apps x COLOR PICKER 3 Ww SPACES UPGRADE NEWSLETTER schools GET CERTIFIED REPORT ERROR Top Tutorials HTML Tutorial CSS Tutorial JavaScript Tutorial How To Tutorial SQL Tutorial Python Tutorial W23.CSS Tutorial htipsuwaew.wdechools.comipythonfpython_variables_multinle.asp a6 w i i ., Tutorials + Exercises ¥ = CSS JAVASCRIPT = SQL lop References HTML Reference CSS Reference JavaScript Reference SQL Reference Python Reference Wa.CSS Reference Bootstrap Reference PHP Reference HTML Colors Java Reference ‘Angular Reference jQuery Reference Top Examples HTML Examples SS Examples JavaScript Examples How To Examples ‘SQL Examples Python Examples W23.CSS Examples Bootstrap Examples PHP Examples Java Examples XML Examples jQuery Examples G@ @ B® © Forum asour Pylon Variable Services ¥ Assign Multple Values Q 0 SignUp Login JAVA PHP = HOWTO —W3.CSS Get Certified HTML Certificate css Certificate JavaScript Certificate Front End Certificate SQL Certificate Python Certificate PHP Certificate Query Certificate Java Certificate c+ Certificate i Certificate XML Certificate 'W3Schools is optimized for learning and training. Examples might be simplified to improve reading and learning Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. While using W3Schools, you agree to have read and accepted our terms of use, cookie and privacy policy. Copyright 1999-2023 by Refsnes Data. All Rights Reserved. W3Schools is Powered by htipsifwnww.w3schoots.comipythonipython_variables_mutiple asp 46 0471212028 10:14 Pylon Variables - Assign Multple Values 3 w Tutorials» —Exercisese Servicese§ QU O SignUp Login schools SQL. PYTHON JAVA PHP = HOWTO. —-W3,CSS_—C 56

You might also like