Google Bard For Coders
Google Bard For Coders
Google Bard For Coders
Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
Agenda
In this session, we will discuss:
● Introduction to Bard
● Bard to build programs
● Code Interpreter in Bard
● Interpreting Code using Bard
● Debugging with Bard
● Exception Handling using Bard
● Testing using Bard
● Extra uses of Bard
● Coding Limitations of Bard
Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
Introduction to Bard
Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
Introduction to Bard
● Conversational AI can mimic human speech, interpret emotion, and respond to queries.
● It uses machine learning and artificial intelligence as its foundation.
● Frequently used examples of conversational AI include chatbots and virtual assistants like Bard, Bard
etc.
● Bard is built using LaMDA which a conversational AI model that can engage user with natural
conversation.
● BARD is a language model that Google has created to help computers better interpret and process
human language.
● It is founded on the Transformer architecture, a deep learning model presented by Vaswani in 2017.
● This architecture is created to process data sequences, such phrases or paragraphs, in parallel,
making it extremely effective with generative AI.
Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
Bard to build programs
Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
Bard to build programs
Task 1: Program to build BMI Calculator
Prompt:
Write a program in Python to calculate BMI
Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
Code Interpreter in Bard
Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
Code Interpreter in Bard
● Bard can generate code in more than 20 programming languages, including C++, Go,
Java, JavaScript, Python, and TypeScript.
● It can also execute code and explain code snippets.
● Commands used for coding in Bard:
!print command to print the results of the code execution.
!debug command to debug the code execution.
!help command to get help on the !exec and !execfile commands.
Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
Interpreting Code using Bard
Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
Interpreting Code using Bard
Task 1 : Program to add two numbers
Prompt:
Write a program to add two numbers
Task 2 : Modify the existing code file adding extra code features
Prompt:
Add other arithmetic operations for the existing code
Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
Debugging with Bard
Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
Debugging with Bard
Task 1: Paste/Type below code on Bard interface and find the error
Prompt 1:
Debug the program and provide corrected code
Prompt 2:
Is there any other method which can be used in coding the same problem statement
Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
Debugging with Bard
Task 1: Paste /Type below code on Bard interface and find the error
Prompt 1:
Debug the program and provide corrected code
Prompt 2:
Is there any other method which can be used in coding the same problem statement
Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
Exception Handling using Bard
Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
Exception Handling using Bard
Task 1: Paste /Type below code on Bard interface and find the type of error
Prompt 1:
Add an exception for the above code
Prompt 2:
Add an exception to handle decimal index value
Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
Exception Handling using Bard
Task 2: Paste /Type below code on Bard interface and find the type of error
Prompt 1:
Add an exception for the above code
Prompt 2:
Add an exception with another logic
Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
Testing using Bard
Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
Testing using Bard
Prompt 1:
Write unit test for above code
Prompt 2:
Suggest code improvement ideas for the above code
Prompt 3:
Implement any one of the idea and provide the code
Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
Extra uses of Bard
Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
Extra uses of Bard
Prompt 1:
Provide code documentation for the above code
Prompt 2:
Suggest code improvement ideas for the above code
Prompt 3:
Implement any one of the idea and provide the code
Prompt 4:
Create a dummy spreadsheet with four columns (Name, Age, Income, City) and fill
it with 10 rows of dummy data. Format the resulting spreadsheet data as a table.
Check in GPT 3.5 and 4
Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
Coding Limitations of Bard
Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
Coding Limitations of Bard
Bard is a large language model that is still under development. As such, it has some limitations when it comes to
coding.
Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
Summary
A quick recap:
Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
Summary
A quick recap:
Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited