Python Basic:

Variables and print function:

A variable is nothing but it allocates the memory space and holds the values.

Syntax:

variable_name = value
print('print statement', variable_name)  or
print("print statement", variable_name)
    Example:

    a = 5
    print('value is:', a)  
    print("a value is:",a)
      output:

      Another form of varible declartion:
      Example:
              a,b,c=2,3,5
      The above example describes a=2,b=3, and c=5.
      Escape sequence:

      Escape sequence
      Description
      Example
      Output
      \n
      New line or next line
      Print(“Hai! \n I am Sabrina.”)
      Hai!
      I am Sabrina.
      \t
      Horizontal tab(one tab space)
      Print(‘Hai\t Hello’)
      Hai             hello
      \’
      Display single-quotes
      Print(‘I don\’t know’)
      I don’t know
      \”
      Display double-quotes
      Print(‘/”Hey/”’)
      “Hey”
      \\
      Print slash
      Print(‘a\\b’)
      a/b

      Comments:

      It describes what's going on inside a program, so that person looking at the source code does not have a hard time figuring it out.
      Types of comments:
      (i)Single line comments:
      Using Hash symbol #
          Syntax:
              #Statements
         Example:
             #This is the addition program
      (ii)Multiline comments:
      Using single or double-quotes.
          Syntax:
             '''Set of Statements or something''' 
         Example:
           '''This program having some fault
             a=d
            print(a)'''
      Input function:

      This input function is used to value get from users.
      Syntax:

      variable_name = data_type(input("Senetence"))
        Example:

        a =int(input("Enter  first number"))
        b =int(input("Enter Second number"))  
        print("The addition value is:",a+b)
          output:


          Multiple Input value get from user:

          Using Split() function.
          Syntax:

          No.of.variable_name = input("Senetence").split()
            Example:

            a,b,c =input('enter values').split()
            print("The addition value is:",int(b)+int(c))
            print(a,b,c)
              output:



              Previous                                                                                    Next  

              Share:

              How to solve pip3 is not recognized?

              Error:
              'pip3'  is not recognized as an internal or external command, operable program or batch file.

              Causes:
              If you do not add the Python Script folder in Environment variable then we got the above error.
              Solution:
              If you want more detail steps, follow the below link
              Share:

              How to fix ModuleNotFoundError: No module named 'mysql.connector'; 'mysql' is not a package

              ModuleNotFoundError:
              Example:
              Solution:
              Share:

              How to install pymysql and set it configurations

              PyMysql installation steps:

              Step 1: First you must install MySQL. If you do not install then click the below link to install the MySQL database. 

              https://www.whereisstuff.com/2020/02/how-to-install-mysql-database-and-set.html

              Step 2: Set the environment variable for python. Following steps,




              In window 7,

              Step 3: Install pymysql, Open cmd and go to your python installer place.

              Give command like,

              Ex:



              1. cd C:\Users\KUMAR\AppData\Local\Programs\Python\Python38-32\Scripts
              2. pip install pymysql
              3. enter
              Now we can use import pymysq package in python.
              Share:

              Python Introduction and installation

              Python Introduction:

              What is Python:

              Python is an interpreted, high-level programming language. This python was created by Guido van Rossum and released in 1991.

              Benefits:
              • Python provides an easy syntax which makes programming simple and is done in a very compact manner.
              • Main The aim of Python programming language is to make the code readable. 
              • Python provides a large standard library that manages memory automatically.
              Application:
              • Web site & web applications,
              • Scientific & Numeric computing,
                       Ex: Packages (earthpy for earth science, astropy for astronomy )  
              • Python for developing desktop GUI applications, and so on.
              Reasons to choose python:
              • Simple elegant syntax
              • Not overly strict
              • Greate community & support
              Download & Installation:
              Step1: First see your OS. For example, I have windows 10 64 bit OS. Right-click on Mycomputer icon and select properties.






















              Step2: Click the below link for download python software.

              https://www.python.org/downloads/windows/

              Step3: Go to download folder and right-click on python software, choose run as administrator for install the python.

              Step4: Then just click two check-box and click on Install now. 




              Step5: Once the setup successfully done, then close it. 

              Open Python software:
              Go to start and browse a Python folder, then choose IDLE (python 3.8.1 64 bit). 
              Python can work in two modes:
              1.Script Mode(IDLE(Python 3.8.1 64-bit ))


              2.Shell Mode(Python 3.8.1 64-bit)



                                                                                                                        Next  
              Share:

              How to install mysql database and set configuration

              Mysql database installation:
              Hi, I hope this tutorial will be better for you. I am showing how to install the MySQL database and set its configuration 
              Steps:
              Step1: Click the below link to download the Mysql database.
              https://dev.mysql.com/downloads/installer/
              In the above link, select 398.9mb to  download,




              Step2: After downloading, right-click on the MySQL software and click the install option.



              Step3: wait for the window configure to MySQL software installer. 


              Step4: Choose any setup type, here I install the developer default setup type for developing and testing work and press the next button. 


              Step5: To install MySQL database require a network. So just click the execute button.




              Step6: If you click in the execute button, it will display a popup message for continue download. Just click the yes button.  



              Step7: The below screenshot is explained, installation of the following products so just gives execute.  




              Step8: Once successfully installed then it display ready to configure. Then go to the next.



              Step9: Just click the next button.




              Step10: Again click the next button.




              Step11: Here, Set password for the MySQL database. 




              Step12: If successfully applied configuration just clicks continue for router configuration.




              Step13: Give a password and if you need to change the user name, you can change here.  



              Step14: The check button is used to check the username and password of the MySQL database configuration.





              Step15: Once successfully router configuration is applied then apply then just click next button only.





              Step16: If successfully installed the MySQL then automatically opens Mysql workbench software.


              Share:

              How to link hr_operating_units and hz_cust_acct_sites_all in oracle

              Solution:-
              The hr_operating_units table having the unique column that is ORGANIZATION_ID and hz_cust_acct_sites_all having the column ORG_ID which is used to join the hr_operating_units for getting customer operating_unit or getting customer details.

              Example:-

              select hou.name operating_unit,hcas.cust_acct_id
              from hr_operating_units hou,hz_cust_acct_sites_all hcas
              where hou.ORGANIZATION_ID=hcas.ORG_ID
              Share:

              AttributeError: 'NoneType' object has no attribute 'get'

              Sample program:

              import tkinter as tk
              master = tk.Tk()
              tk.Label(master, text="First Number").grid(row=0, column=0)
              tk.Label(master, text="Second Number").grid(row=1, column=0)
              tk.Label(master, text="Value").grid(row=2, column=0)
              # Display entry fields
              e1 = tk.Entry(master).grid(row=0, column=1) 
              e2 = tk.Entry(master).grid(row=1, column=1)
              def display():
                          a=int(e1.get())
                          b=int(e2.get())
                          tot=a=b
                          tk.Label(master, text=str(tot)).grid(row=2, column=1)       
              # end of display function
              # button to display all the calculated total 
              button1=tk.Button(master, text="Submit", bg="green", command=display)
              button1.grid(row=6, column=1)
              master.mainloop()

                Output:
                Error:
                1. Exception in Tkinter callback
                  Traceback (most recent call last):
                    File "C:\Users\KUMAR\AppData\Local\Programs\Python\Python38-32\lib\tkinter\__init__.py", line 1883,
                   in __call__
                      return self.func(*args)
                    File "C:/Users/KUMAR/AppData/Local/Programs/Python/Python38-32/myprgm/rough.py", line 10,
                   in display
                      a=int(e1.get())
                  AttributeError: 'NoneType' object has no attribute 'get'.

                Problem:
                •  None Type means, You got no value. It means an assignment or function call up failed.
                Solution:
                •  If the entry field contains some calculation, then entry field declaration and place value must be separate.

                e1 = tk.Entry(master)
                e2 = tk.Entry(master)
                e1.grid(row=0, column=1) 
                e2.grid(row=1, column=1) 

                Share:

                Recent Posts

                Service Support

                Need our help to Learn or Post New Concepts Contact me