0% found this document useful (0 votes)
22 views34 pages

GitHub Copilot For Python

python

Uploaded by

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

GitHub Copilot For Python

python

Uploaded by

jatinchaurasia07
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 34

GitHub Copilot for Python

Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
Agenda
In this session, we will discuss:
● Introduction to GitHub Copilot
● Steps to install PyCharm IDE
● Installing the GitHub Copilot plugin to PyCharm
● Python Basics
● Data Structures in Python
● Control Flow and Conditional Statements
● Functions and Methods
● Python Classes and Objects
● Working with files
● Demo Programs
● Case Study
Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
Introduction to GitHub Copilot

Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
Introduction to GitHub Copilot
● AI Developer Tool
● A generative AI model developed by GitHub, OpenAI, and Microsoft

o Sharp and intelligent code suggestions

o Auto completes codes

o Code faster

o Understand file type

o Cloud code understanding

o Database understanding

o IDE integration

o Gives best suggestions

Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
Introduction to GitHub Copilot
The IDE’s supported by GitHub are:

Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
Steps to install PyCharm IDE

Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
Steps to Install PyCharm IDE
Step 1: Visit the official website: https://www.jetbrains.com/pycharm/download
Step 2: Choose the right operating system Windows, Mac, or Linux.
Step 3: Download the .exe file of PyCharm Community Edition.
Step 4: Install it to your local system.

Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
Installing the GitHub Copilot plugin
to PyCharm

Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
Installing the GitHub Copilot plugin to PyCharm
Step 1: Click on File  Settings  Choose Plugin  Search for GitHub Copilot  Install
Step 2: Restart the PyCharm IDE
Step 3: Link PyCharm to GitHub Copilot (Trial Version)
Step 4: Add the activation code and login

Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
Python Basics

Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
Python Basics
Variables are used to store data values that can be manipulated and accessed throughout a program.

Examples:

Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
Python Basics

Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
Python Basics
Datatypes specify the type of data that can be stored inside a variable.

int, float,
Numeric holds numeric values
complex

String str holds sequence of characters

Sequence list, tuple, range holds collection of items

Mapping dict holds data in key-value pair form

Boolean bool holds either True or False

Set set, frozenset hold collection of unique items

Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
Python Basics

Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
Python Basics
Strings in Python are sequences of characters enclosed in single, double, or triple quotes.

Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
Python Basics

Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
Data Structures in Python

Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
Data Structures in Python
List is an ordered collection of similar or different types of items separated by commas and enclosed within
square brackets.

Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
Data Structures in Python
Tuple is an ordered sequence of items same as a list. The only difference is that tuples are immutable. Tuples
once created cannot be modified.

Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
Data Structures in Python
Dictionary is an ordered collection of items. It stores elements in key/value pairs. Here, keys are unique
identifiers that are associated with each value.

Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
Data Structures in Python
Set is an unordered collection of unique items. Set is defined by values separated by commas inside braces { }.

Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
Control Flow and Conditional
Statements

Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
Control Flow and Conditional Statements
Control Flow Statements:
We use the if statement to run a block code only when a certain condition is met.
• if statement
• if … else statement
• if ... elif… else statement

Conditional Statements:
• for loop - is used to iterate over sequences such as lists, tuples, strings, etc.
• while loop - is used to run a block code until a certain condition is met.

Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
Functions and Methods in Python

Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
Functions and Methods in Python
• Functions in Python are blocks of code that perform a specific task or computation.
• They can be defined using the def keyword followed by a function name and a block of code.
• Functions can take zero or more input parameters (arguments) as inputs.
• They can return a result using the return statement.
• Functions are typically defined outside of classes, although they can also be nested within other functions.
• Functions are called by their name, followed by parentheses, with arguments passed inside the parentheses.

Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
Functions and Methods in Python
• Methods are functions that are associated with objects, typically within classes.
• They are defined within the class definition and operate on instances (objects) of that class.
• Methods have access to the data and attributes of the object they are called on, via the self parameter.
• Methods are called on objects using the dot notation.

Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
Python Classes and Objects

Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
Python Classes and Objects
Classes:
• A class is a blueprint for creating objects.
• It defines the attributes (data) and methods (functions) that objects created from the class will have.
• The basic structure of a class in Python includes the class keyword, followed by the class name and a colon.
• The class body contains attributes and methods.
Objects:
• An object is an instance of a class. It is created using the class name followed by parentheses.
• Objects have their own set of attributes and can call methods defined in the class.

Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
Working with files

Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
Working with Files
Working with files in Python involves several operations such as reading from files, writing to files, and performing
various file-related tasks.
• Opening and closing files
• Reading files
• Writing files
• Appending files

Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
Demo Programs

Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
Demo Programs
• Program to convert decimal to octal
• Program to print ASCII Value of a character
• Python Program for cube sum of first n natural numbers

Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
Case Study

Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
Summary
A quick recap:

● GitHub Copilot is a generative AI model developed by GitHub, OpenAI, and Microsoft.


● Explained the steps to install PyCharm and GitHub Copilot.
● Demonstrated simple codes related to the basics of python like variables, datatypes etc.
● Listed various data structures in Python.
● Illustrated programs related to control flow and conditional statements, functions, methods, python classes,
objects, and files.
● Generated code for employee feedback system.

Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited

You might also like