jagomart
digital resources
picture1_Lecture2 5q88c0w


 137x       Filetype PDF       File size 0.38 MB       Source: etut.edu.tm


File: Lecture2 5q88c0w
modernisation of higher education in central asia through new technologies hiedtec object oriented programming lecture2 defining variables in programming a variable is a value that can change depending on the ...

icon picture PDF Filetype PDF | Posted on 05 Feb 2023 | 2 years ago
Partial capture of text on file.
                              MODERNISATION  OF  HIGHER  EDUCATION  
                                       IN  CENTRAL  ASIA  
                                 THROUGH  NEW  TECHNOLOGIES  
                                         ( HiEdTec ) 
             
             
                            Object Oriented Programming 
                               Lecture2: Defining variables 
             
                In programming, a variable is a value that can change, depending on the 
            conditions or on information passed to the program. Typically, a program consists 
            of instruction s that tell the computer what to do and data that the program uses when 
            it is running. The data consists of constants or fixed values that never change and 
            variable values (which are usually initialized to "0" or some default value because 
            the actual values will be supplied by a user's program). Usually, both constants and 
            variables are defined as certain data type s. Each data type prescribes and limits the 
            form of the data. Examples of data types include: an integer expressed as a decimal 
            number, or a string of text characters, usually limited in length. 
                Variables are used to store information to be referenced and manipulated in a 
            computer program. They also provide a way of labeling data with a descriptive 
            name, so our programs can be understood more clearly by the reader and ourselves. 
            It is helpful to think of variables as containers that hold information. Their sole 
            purpose is to label and store data in memory. This data can then be used throughout 
            your program. 
            Assigning Value to Variables 
                Naming variables is known as one of the most difficult tasks in computer 
            programming. When you are naming variables, think hard about the names. Try 
            your best to make sure that the name you assign your variable is accurately 
            descriptive and understandable to another reader. Sometimes that other reader is 
            yourself when you revisit a program that you wrote months or even years earlier. 
            When you assign a variable, you use the = symbol. The name of the variable goes 
            on the left and the value you want to store in the variable goes on the right. 
             
            Creating Variables 
            Variables are containers for storing data values. 
            Unlike other programming languages, Python has no command for declaring a 
            variable. 
            A variable is created the moment you first assign a value to it. 
                                                             MODERNISATION  OF  HIGHER  EDUCATION  
                                                                               IN  CENTRAL  ASIA  
                                                                    THROUGH  NEW  TECHNOLOGIES  
                                                                                    ( HiEdTec ) 
                         
                        Example 
                        x = 5 
                        y = "Sapartach" 
                        print(x) 
                        print(y) 
                        Variables do not need to be declared with any particular type and can even change 
                        type after they have been set. 
                        Example 
                        x = 4 # x is of type int 
                        x = "Sally" # x is now of type str 
                        print(x) 
                        String variables can be declared either by using single or double quotes: 
                        Example 
                        x = "Sapartach" 
                        # is the same as 
                        x = 'Sapartach' 
                        Variable Names 
                        A variable can have a short name (like x and y) or a more descriptive name (age, 
                        car name, total volume). Rules for Python variables: 
                                 A variable name must start with a letter or the underscore character 
                                 A variable name cannot start with a number 
                                 A variable name can only contain alpha-numeric characters and underscores 
                                  (A-z, 0-9, and _ ) 
                                 Variable names are case-sensitive (age, Age and AGE are three different 
                                  variables) 
                        Example 
                        #Legal variable names:                           
                        myvar = " Sapartach " 
                        my_var = " Sapartach " 
                                             MODERNISATION  OF  HIGHER  EDUCATION  
                                                          IN  CENTRAL  ASIA  
                                                  THROUGH  NEW  TECHNOLOGIES  
                                                             ( HiEdTec ) 
                 
                _my_var = " Sapartach" 
                myVar = "Sapartach " 
                MYVAR = "Sapartach " 
                myvar2 = "Sapartach " 
                 
                #Illegal variable names:          
                2myvar = "Sapartach" 
                my-var = "Sapartach " 
                my var = "Sapartach " 
                Remember that variable names are case-sensitive 
                Assign Value to Multiple Variables  
                Python allows you to assign values to multiple variables in one line: 
                Example 
                x, y, z = "Orange", "Banana", "Cherry" 
                print(x) 
                print(y) 
                print(z) 
                And you can assign the same value to multiple variables in one line: 
                Example 
                x = y = z = "Orange" 
                print(x) 
                print(y) 
                print(z) 
                 
                 
                 
                 
                 
                 
                 
                 
                 
                 
                 
                           MODERNISATION  OF  HIGHER  EDUCATION  
                                   IN  CENTRAL  ASIA  
                              THROUGH  NEW  TECHNOLOGIES  
                                    ( HiEdTec ) 
            
            
                                REFERENCES: 
                                       
           1.”Turkmenistanyn Konstitusiýasy”. Aşgabat, TDNG.2008. 
           2. ”Turkmenistanyn Prezidenti Gurbanguly Malikgulyyewiç Berdimuhamedowyň gysgaça 
           terjimehaly”.- Asgabat, TDNG.2007. 
           3. Gurbanguly Berdimuhamedow. ”Garaşsyzlyga guwanmak, Watany, halky söýmek bagtdyr”- 
           Asgabat, TDNG.2007. 
           4. Gurbanguly Berdimuhamedow.” Parahatçylyk, döredijilik, progres syýasatynyň 
           dabaralanmagy”- Asgabat, TDNG.2007. 
           5. Gurbanguly Berdimuhamedow. “Halkyň saýlany we ynam bildireni”- Asgabat,TDNG.2007. 
           6. John Shovic and Alan Simpson, “Python All-in-One For Dummies”, New Jersey, 2019 
           7. Michel Anders, “Python 3 Web Development Beginner's Guide”, UK, 2011 Packt 
           Publishing 
           8. Python Crash Course, 2nd Edition: A Hands-On, Project-Based Introduction. 3pnK 
           MaTTec. 20 Hoadpa 2015 r. 
           9. Automate the Boring Stuff with Python: Practical Programming for Total. Ant 
           CBenrapT. 14 anpena 2015 r. 
           10. Fluent Python. Knnra, Jlycnano Pamanbo. 2015 r. 
           11. David Beazley and Brian Jones , “Python Cookbook, Third Edition” United States of 
           America, 2013 
           12. www.w3schools.com 
           13. Problem book on programming. Scalar types, control statements, procedures and 
           functions, arrays, strings, files, recursion, dynamic data structures. A. V. Abramyan, M. E. 
           Abramyan. The Ministry of Education and Science of the Russian Federation Southern 
           Federal University. Rostov-on-Don 2014 
           14. Python Programming for Beginners: An Introduction to the Python Computer 
           Programming. Kunra, Alencon KOHHOH. 2014 r 
           15. Fluent Python. Knnra, Jlycnano Pamanbo. 2015 r. 
           16. JerKHH cnocod BbiyunTb Python. Kunra, 3eg ffloy. 19 ceHTadpa 2013 r. 
           17. www.tutorialspoint.com 
            
            
The words contained in this file might help you see if this file matches what you are looking for:

...Modernisation of higher education in central asia through new technologies hiedtec object oriented programming lecture defining variables a variable is value that can change depending on the conditions or information passed to program typically consists instruction s tell computer what do and data uses when it running constants fixed values never which are usually initialized some default because actual will be supplied by user both defined as certain type each prescribes limits form examples types include an integer expressed decimal number string text characters limited length used store referenced manipulated they also provide way labeling with descriptive name so our programs understood more clearly reader ourselves helpful think containers hold their sole purpose label memory this then throughout your assigning naming known one most difficult tasks you hard about names try best make sure assign accurately understandable another sometimes other yourself revisit wrote months even ye...

no reviews yet
Please Login to review.