[go: up one dir, main page]

0% found this document useful (0 votes)
112 views29 pages

Final Project Report

Anusha Aarohi Saxena completed a 5 week internship at Kodacy from May 5th to June 17th 2023 where she worked on a project to build a text-based game using Python. The document provides details about Python's history and uses, including for artificial intelligence and real world applications. It also covers the basics of Python programming concepts like data types, variables, strings, tuples, lists, operators, loops, conditional statements, and functions.

Uploaded by

Krishna Soni
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)
112 views29 pages

Final Project Report

Anusha Aarohi Saxena completed a 5 week internship at Kodacy from May 5th to June 17th 2023 where she worked on a project to build a text-based game using Python. The document provides details about Python's history and uses, including for artificial intelligence and real world applications. It also covers the basics of Python programming concepts like data types, variables, strings, tuples, lists, operators, loops, conditional statements, and functions.

Uploaded by

Krishna Soni
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/ 29

Industrial Training Report

on
Python

Complete at
Kodacy

Duration
5th May 2023 To 17 th June 2023

Submitted By
Anusha Aarohi Saxena
V Semester
Enrollment No.:21E1EBADF40P002

DEPARTMENT OF ARTIFICIAL INTELLIGENCE & DATA SCIENCE


ENGINEERING COLLEGE BIKANER
[BIKANER TECHNICAL UNIVERSITY, BIKANER]
BIKANER, RAJASTHAN
STUDENT DECLARATION

I hereby declare that the Industrial Training Report on Python completed at Kodacy is

an authentic record of my own work as requirement of Industrial Training as a part of

the V semester syllabus during the period from 05 th May 2023 to 17 th June 2023

submitted at the Department of Artificial Intelligence and Data Science,

Engineering College Bikaner for the award of the degree of B.Tech. in Artificial

Intelligence and Data Science by Bikaner Technical University, Bikaner.

Anusha Aarohi Saxena


21EEBAD002
Date: 21-02-2024
TABLE OF CONTENTS

Certificate

Student Declaration

1. Introduction 1-4

1.1 Scripting Language 1

1.2 History of Python 1

1.3 About the Project Made 2

1.3.1 Building a Text Based Game 2

1.4 Use of Python in Real World 2

1.5 Scope of Python 3

1.6 Python for Artificial Intelligence 4

2. Basics of Python 5-20

2.1 Data Type 5

2.2 Variables 5

2.3 Strings 6

2.4 Tuples 6

2.4.1 Accessing Values in Python 6

2.4.2 Built-in Tuple Functions 7

2.5 List 8

2.5.1 Accessing Values in Lists 8

2.5.2 Built-in Functions in List 9

2.6 Python Operators 10

2.6.1 Arithmetic Operators 11

2.6.2 Comparison Operators 12

2.6.3 Bitwise Operators 13


2.6.4 Logical Operators 15

2.6.5 Assignment Operators 16

2.7 Loops used in Python 18

2.8 Conditional Statements 19

2.8.1 If Statement 20

2.8.2 If…Else Statement 20

2.9 Functions 20

2.9.1 Syntax of Function in Python 20

3. Project 21-22

3.1 Building a Text Based Game 21

4. Conclusion 24

References

Appendices
INTRODUCTION
Python is a widely used high-level, general-purpose, interpreted, dynamic programming
language. Its design philosophy emphasizes code readability, and its syntax allows
programmers to express concepts in fewer lines of code than would be possible in
languages such as C++ or Java. The language provides constructs intended to enable clear
programs on both a small and large scale.
Python supports multiple programming paradigms, including object-oriented, imperative
and functional programming or procedural styles. It features a dynamic type system and
automatic memory management and has a large and comprehensive standard library.
Python interpreters are available for installation on many operating systems, allowing
Python code execution on a wide variety of systems.

1.1 Scripting language


A scripting or script language is a programming language that supports scripts, programs
written for a special run-time environment that automate the execution of tasks that could
alternatively be executed one-by-one by a human operator.
Scripting languages are often interpreted (rather than compiled). Primitives are usually the
elementary tasks or API calls, and the language allows them to be combined into more
complex programs. Environments that can be automated through scripting include software
applications, web pages within a web browser, the shells of operating systems (OS),
embedded systems, as well as numerous games.

1.2 History of Python


Python was conceived in the late 1980s, and its implementation was started in December
1989 by Guido van Rossum at CWI in the Netherlands as a successor to the ABC language
(itself inspired by SETL) capable of exception handling and interfacing with the Amoeba
operating system. Van Rossum is Python's principal author, and his continuing central role
in deciding the direction of Python is reflected in the title given to him by the Python
community, benevolent dictator for life.
About the origin of Python, Van Rossum wrote in 1996:
Over six years ago, in December 1989, I was looking for a "hobby" programming project
that would keep me occupied during the week around Christmas. My office ... would be

1
closed, but I had a home Computer, and not much else on my hands. I decided to write an
interpreter for the new scripting language I had been thinking about lately: a descendant of
ABC that would appeal to Unix/C hackers. I chose Python as a working title for the project,
being in a slightly irreverent mood (and a big fan of Monty Python's Flying Circus).

1.3 About the Project Made


This is the project on rock, paper and scissors game:
1.3.1 Building a Text Based Game
● Last summer, I worked upon on an interesting project on python which seems to be very
simple yet quite the fun
● This project is based on importing various libraries i.e, Random library which makes
random argument with the help of computer's logic
● Almost all module functions depend on the basic function random keyword, which
generates a random float uniformly in the half-open range 0.0 <= X < 1.0. Python uses the
Mersenne Twister as the core generator. It produces 53-bit precision floats and has a period
of 2**19937-1. The underlying implementation in C is both fast and thread safe. The
Mersenne Twister is one of the most extensively tested random number generators in
existence. However, being completely deterministic, it is not suitable for all purposes, and
is completely unsuitable for cryptographic purposes.
● This little game is based on Rock, Paper and Scissors.

1.4 Use of Python in Real World

Python is being applied in real revenue-generating products by real companies. Google


makes extensive use of Python in its web search system, and employs Python’s creatIntel,
Cisco and Hewlett-Packard, Seagate, Qualcomm, and IBM use Python for hardware testing.
ESRI uses Python as an end-user customization tool for its popular GIS mapping
products.

1.5 Scope of Python

-Science

- Bioinformatics

2
- System Administration

- Unix

-Web logic

-Web sphere
The things that we can do with Python are as follows:
- System programming
- Graphical User Interface Programming 3 - Internet Scripting
- Component Integration
- Database Programming
-Gaming, Images, XML, Robot and more.

1.6 Python for Artificial Intelligence


Here are some specific examples of how Python is used in AI:
• Machine learning:

Python is a popular language for machine learning because of its powerful libraries, such
as TensorFlow, PyTorch, and Scikit-learn. These libraries provide a variety of tools and
algorithms for training and deploying machine learning models.

• Natural language processing:

Python is also a popular language for natural language processing (NLP) tasks, such as
text classification, sentiment analysis, and machine translation. There are a number of
Python libraries that are specifically designed for NLP tasks, such as NLTK and spaCy.

• Robotics:
Python is also used in robotics to control robots and to develop AI algorithms for
robots. There are a number of Python libraries that are specifically designed for robotics,
such as ROS and RobotPy.
With libraries like NumPy, Matplotlib, Pandas, etc., developers can efficiently visualize
data, thus making it easier to gain insights and identify patterns that inform the AI model
design. Also, Python excels in data preparation and preprocessing, which are considered
as most crucial steps in building AI models.

3
According to the father of Artificial Intelligence, John McCarthy, it is “The science and engineering of
making intelligent machines, especially intelligent computer programs”.

Artificial Intelligence is a way of making a computer, a computer-controlled robot, or a software think


intelligently, in the similar manner the intelligent humans think. AI is accomplished by studying how
human brain thinks and how humans learn, decide, and work while trying to solve a problem, and then
using the outcomes of this study as a basis of developing intelligent software and systems.

4
BASICS OF PYTHON
2.1 Data Type
Data types determine whether an object can do something, or whether it just would not
make sense. Other programming languages often determine whether an operation makes
sense for an object by making sure the object can never be stored somewhere where the
operation will be performed on the object (this type system is called static typing). Python
does not do that. Instead it stores the type of an object with the object, and checks when the
operation is performed whether that operation makes sense for that object.
Python has many native data types. Here are the important ones:
Booleans are either True or False.
Numbers can be integers (1 and 2), floats (1.1 and 1.2), fractions (1/2 and 2/3), or even
complex numbers.
Strings are sequences of Unicode characters, e.g. an HTML document.
Bytes and byte arrays, e.g. a JPEG image file.
Lists are ordered sequences of values.
Tuples are ordered, immutable sequences of values.
Sets are unordered bags of values.

2.2 Variables
Variables are nothing but reserved memory locations to store values. This means that when
you create a variable you reserve some space in memory.
Based on the data type of a variable, the interpreter allocates memory and decides what
can be stored in the reserved memory. Therefore, by assigning different data types to
variables, you can store integers, decimals or characters in these variables.
Ex: counter = 100 # An integer assignment miles = 1000.0
floating point name = "John" # A string

2.3 Strings
In programming terms, we usually call text a string. When you think of a string as a
collection of letters, the term makes sense.
All the letters, numbers, and symbols in this book could be a string. For that matter, your
name could be a string, and so could your address.

5
For example -
"Geeksforgeeks" or 'Geeksforgeeks' or "a"
Strings are assigned in “” or ‘’. Strings can be letters, numbers or any kind of characters.
Strings also perform operations like slicing, indexing, extracting
and comparison, for example-
1. string = “hello”
print(string[0])
Output-
“h’ #indexing
2. string = “hello”
print(string[1:4])
Output-
“ell” # slicing

2.4 Tuples
A tuple is a sequence of immutable Python objects. Tuples are sequences, just like lists.
The differences between tuples and lists are, the tuples cannot be changed unlike lists and
tuples use parentheses.

2.4.1 Accessing Values in Tuples:


To access values in tuple, use the square brackets for slicing along with the index or indices
to obtain value available at that index. For example − tup1 = ('physics', 'chemistry', 1997,
2000); tup2 = (1, 2, 3, 4, 5, 6, 7 ); print "tup1[0]: ", tup1[0] print "tup2[1:5]: ", tup2[1:5].
When the above code is executed, it produces the following result − tup1[0]: physics
tup2[1:5]: [2, 3, 4, 5]
Basic Tuples Operations-
Tuples respond to the + and * operators much like strings; they mean concatenation and
repetition here too, except that the result is a new tuple, not a string. In fact, tuples respond
to all of the general sequence operations we used on strings.

6
Table 2.1 Basic Tuple Operation in Python

Python Results Description


Expression

len((1, 2, 3)) 3 Length

(1, 2, 3) + (4, 5, (1, 2, 3, 4, 5, 6) Concatenation


6)

('Hi!',) * 4 ('Hi!', 'Hi!', 'Hi!', Repetition


'Hi!')

3 in (1, 2, 3) True Membership

2.4.2 Built-in Tuple Functions


Python includes the following tuple functions −
Table 2.2 Functions used by tuples

Function with Description

cmp(tuple1, tuple2) Compares elements of both tuples.

len(tuple) Gives the total length of the tuple.

max(tuple) Returns item from the tuple with max value.

min(tuple) Returns item from the tuple with min value.

7
2.5 List
The list is a most versatile datatype available in Python which can be written as a list of
comma- separated values (items) between square brackets. Important thing about a list is
that items in a list need not be of the same type.
Creating a list is as simple as putting different comma-separated values between square
brackets. For example − list1 = ['physics', 'chemistry', 1997, 2000]; list2 = [1, 2, 3, 4, 5 ];
list3 = ["a", "b", "c", "d"];
Similar to string indices, list indices start at 0, and lists can be sliced, concatenated and so
on.

2.5.1 Accessing Values in Lists:


To access values in lists, use the square brackets for slicing along with the index or indices
to obtain value available at that index. For example − list1 = ['physics', 'chemistry', 1997,
2000]; list2 = [1, 2, 3, 4, 5, 6, 7 ]; print "list1[0]: ", list1[0] print "list2[1:5]: ", list2[1:5].

Output: list1[0]: physics


list2[1:5]: [2, 3, 4, 5]
Update: list = ['physics', 'chemistry', 1997, 2000]; print "Value available at index 2 : " print
list[2] list[2] = 2001; print "New value available at index 2 : " print list[2]
Output: Value available at index 2 :
1997 New value available at index 2
2001
Delete: list1 = ['physics', 'chemistry', 1997, 2000]; print list1 del list1[2]; print "After
deleting value at index 2 : " print list1

['physics', 'chemistry', 1997, 2000]

Output: After deleting value at index 2 : ['physics', 'chemistry', 2000]

Now, we shall discuss about basic list operation with the help of list operation.

List are mutable in python

8
Table 2.3 Basic List Operations

Python Results Description


Expression

len([1, 2, 3]) 3 Length

[1, 2, 3] + [4, 5, [1, 2, 3, 4, 5, 6] Concatenation


6]

['Hi!'] * 4 ['Hi!', 'Hi!', 'Hi!', Repetition


'Hi!']

3 in [1, 2, 3] True Membership

for x in [1, 2, 3]: 123 Iteration


print x,

2.5.2 Built-in Functions in List


Functions are as follows-
Table 2.4 List Built-in Functions

Function with Description

cmp(list1, list2) Compares elements of both lists.

len(list) Gives the total length of the list.

max(list) Returns item from the list with max value.

min(list) Returns item from the list with min value.

9
Python includes following list methods-
Table 2.5 List Methods used by Python

S. No Methods with Description

1 list.append(obj) Appends object obj to list

2 list.count(obj) Returns count of how many times obj occurs in list

3 list.extend(seq) Appends the contents of seq to list

4 list.index(obj) Returns the lowest index in list that obj appears

5 list.insert(index, obj) Inserts object obj into list at offset index

6 list.pop(obj=list[-1]) Removes and returns last object or obj from list

7 list.remove(obj) Removes object obj from list

8 list.reverse() Reverses objects of list in place

9 list.sort([func]) Sorts objects of list, use compare func if given

2.6 Python Operators


Python uses different types of operators like arithmetic, comparison, bitwise and many
more.

2.6.1 Arithmetic Operators

10
Basically used for arithmetic operations like addition, multiplication, division etc. Few of
them are as follows –

Table 2.6 Arithmetic Operators in Python

% Modulus - remainder of the division of left x % y


operand by the right (remai
nder
of x/y)

/ Floor division - division that results into whole x // y


/ number adjusted to the left in the number line

* Exponent - left operand raised to the power of x**y


* right (x to
the
power
y)

2.6.2 Comparison Operators


These operators are used to compare the values and are also known as relational operators
and few of it are as follows-
Table 2.7 Comparison Operators in Python

Operator Description Syntax

Greater than: True if the left


> x>y
operand is greater than the right

Less than: True if the left operand


< x<y
is less than the right

11
Operator Description Syntax

Equal to: True if both operands


== x == y
are equal

Not equal to – True if operands are


!= x != y
not equal

Greater than or equal to: True if


>= left operand is greater than or x >= y
equal to the right

Less than or equal to: True if left


<= operand is less than or equal to the x <= y
right

2.6.3 Bitwise Operators


In Python, bitwise operators are used to perform bitwise calculations on integers. The
integers are first converted into binary and then operations are performed on each bit or
corresponding pair of bits, hence the name bitwise operators. The result is then returned
in decimal format.
Table 2.8 Bitwise Operators used in Python

OPERATOR NAME DESCRIPTION SYNTAX

Result bit 1,if both operand bits are 1;otherwise


& Bitwise AND x&y
results bit 0.

Result bit 1,if any of the operand bit is 1;


| Bitwise OR x|y
otherwise results bit 0.

~ Bitwise NOT inverts individual bits ~x

12
OPERATOR NAME DESCRIPTION SYNTAX

Results bit 1,if any of the operand bit is 1 but not


both, otherwise
^ Bitwise XOR x^y
results bit 0.

The left operand’s value is moved toward right


Bitwise right by the number of bits
>> x>>
shift
specified by the right operand.

The left operand’s value is moved toward left by


Bitwise left the number of bits
<< x<<
shift
specified by the right operand.

The precedence of Bitwise Operators in Python is as follows:


i. Bitwise NOT
ii. Bitwise Shift
iii.Bitwise AND
iv. Bitwise XOR
v. Bitwise OR

2.6.4 Logical Operators


Python Logical operators perform Logical AND, Logical OR, and Logical
NOT operations. It is used to combine conditional statements.
Table 2.9 Logical Operators used in Python

Operator Description Syntax

Logical AND: True if both the


and x and y
operands are true

Logical OR: True if either of


or x or y
the operands is true

13
Operator Description Syntax

Logical NOT: True if the


not not x
operand is false

Precedence of Logical Operators in Python-

The precedence of Logical Operators in Python is as follows:

i. Logical not

ii. Logical and

iii.Logical or

2.6.5 Assignment Operators


These are used to assign values to the variables.
• Basic Assignment Operator: = Assigns a value to a variable.
• Compound Assignment Operators: += Addition assignment. -= Subtraction assignment. *=
Multiplication assignment. /= Division assignment. %= Modulus assignment. //= Floor division
assignment. **= Exponentiation assignment.

Table 2.10 Assignment Operators used in Python


Operator Description Syntax

Assign the value of the right


= side of the expression to the left x=y+z
side operand

Add AND: Add right-side


+= operand with left-side operand a+=b a=a+b
and then assign to left operand

14
Operator Description Syntax

Subtract AND: Subtract right


-= operand from left operand and a-=b a=a-b
then assign to left operand

Multiply AND: Multiply right


*= operand with left operand and a*=b a=a*b
then assign to left operand

Divide AND: Divide left


/= operand with right operand and a/=b a=a/b
then assign to left operand

Modulus AND: Takes modulus


using left and right operands
%= a%=b a=a%b
and assign the result to left
operand

Divide(floor) AND: Divide left


//= operand with right operand a//=b a=a//b
then assign the value(floor)

Exponent AND: Calculate


exponent(raise power) value
**= a**=b a=a**b
using operands and assign
value to left operand

Performs Bitwise AND on


&= operands and assign value to a&=b a=a&b
left operand

15
Operator Description Syntax

Performs Bitwise OR on
|= operands and assign value to a|=b a=a|b
left operand

Performs Bitwise xOR on


^= operands and assign value to a^=b a=a^b
left operand

Performs Bitwise right shift on


>>= operands and assign value to a>>=b a=a>>b
left operand

Performs Bitwise left shift on


<<= operands and assign value to a <<= b a
left operand

There are many operators used by Python such as identity operators etc.

2.7 Loops used in Python

Programming languages provide various control structures that allow for more complicated
execution paths. A loop statement allows us to execute a statement or group of statements
multiple times. The following diagram illustrates a loop statement –

A for loop in Python is used to iterate over a sequence (list, tuple, set, dictionary, and
string). Example: The preceding code executes as follows: The variable i is a placeholder
for every item in your iterable object. The loop iterates as many times as the number of
elements and prints the elements serially.
Loops can be used to perform a variety of tasks, such as:
1. Iterating over a list of items

16
2. Processing data in a file

3. Repeating a task until a certain condition is met

4. Creating complex algorithms


Loops are a powerful tool that can be used to make your Python code more efficient .
Figure 2.1 Illustration of Loops

Indentation is significant in Python. It is used to define a block of code; without indentation,


the program will show an error.
• The condition for a while loop must be a boolean expression.
• The body of a for loop is executed once for each item in the iterable.
• The break statement can be used to exit a loop early.
• The continue statement can be used to skip the rest of the current iteration of a loop.
Loops can be a very powerful tool in Python. They can be used to automate tasks, iterate over data, and
more.
Python programming language provides following types of loops –
For loop, while loop and nested loops and they are as follows with their description-

Table 2.11 Loops used in Python

17
Loops Description
Repeats a statement or group of
while loop statements while a given
condition is TRUE. It tests the
condition before executing the
loop body
Executes a sequence of
for loop statements multiple times and
abbreviates the code that
manages the loop variable.
nested loops You can use one or more loop
inside any another while, for or
do..while loop.

Loop Example-

For Loop:
>>> for mynum in [1, 2, 3, 4, 5]: print ("Hello", mynum )
Hello 1

Hello 2

Hello 3

Hello 4

Hello 5

While Loop:
>>> count = 0 >>while(count< 4):

print 'The count is:', count count = count + 1

The count is: 0

The count is: 1 The count is: 2 The count is: 3

18
2.8 Conditional Statements
Decision making is anticipation of conditions occurring while execution of the program and
specifying actions taken according to the conditions.
Decision structures evaluate multiple expressions which produce TRUE or FALSE as
outcome. You need to determine which action to take and which statements to execute if
outcome is TRUE or FALSE otherwise.
Conditional statements in Python are used to control the flow of execution of a program
based on certain conditions. They are used to make decisions and execute different blocks
of code based on those decisions.
They allow to print result based on comparison.
The conditional statements work upon the basis of the value the condition whether it
evaluate to either true or false and the block of statements gets executed depending upon
the result.
Main conditional statements are as follows-

Table 2.12 Conditional Statements used in Python

Statement Description

if statements An if statement consists of a boolean


expression followed by one or more
statements.

if...else An if statement can be followed by an


statements optional else statement, which executes when
the boolean expression is FALSE.

nested if You can use one if or else if statement inside


statements another if or else if statement(s).

Example:

19
2.8.1 If Statement:
a=33 b=200
If b>a:

print(“b”)

2.8.2 If...Else Statement:


a=200 b=33
if b>a:
print(“b is greater than a”) else:
print(“a is greater than b”)

2.9 Functions
Function blocks begin with the keyword def followed by the function name and parentheses
( ).
Any input parameters or arguments should be placed within these parentheses. You can also
define parameters inside these parentheses.
The first statement of a function can be an optional statement - the documentation string of
the function.
The code block within every function starts with a colon (:) and is indented.
The statement return [expression] exits a function, optionally passing back an expression
to the caller. A return statement with no arguments is the same as return None.

2.9.1 Syntax of Functions in Python


Def function name(parameters): “function_docstring” Function_suite Return[expression]
Example:
Def print me(str):
“this print a passed string into this function” print str
return

1. # Function definition is here def print me( str ):

"This prints a passed string into this function" print str return;
# Now you can call print me function print me("I'm first call to user defined function!")
print me("Again second call to the same function")

20
PROJECT

3.1 Building a Text Based Game


● Last summer, I worked upon on an interesting project on python which seems to be very
simple yet quite the fun.
● This project is based on importing various libraries i.e, Random library which makes
random argument with the help of computer's logic.
● Almost all module functions depend on the basic function random(), which generates a
random float uniformly in the half-open range 0.0 <= X < 1.0. Python uses the Mersenne
Twister as the core generator. It produces 53-bit precision floats and has a period of
2**19937-1. The underlying implementation in C is both fast and threadsafe. The
Mersenne Twister is one of the most extensively tested random number generators in
existence. However, being completely deterministic, it is not suitable for all purposes, and
is completely unsuitable for cryptographic purposes.
● This little game is based on Rock, Paper and Scissors
● The source code of the following game is presented as follows:

Figure 3.1 Code for the game


This figure shows the library and packages used by Python to build the game. The figure also shows
the block of statements written to run the code. The random library hence used creates a choice for
the computer on what to choose among rock, paper and scissors.

This is how this text based game is built in python.

21
Figure 3.2 Statements used in the code and its output in the console
So, this is how our code works using a random library by importing it using the import
keyword and applying random choices to the computer and hence choosing our answer
and comparing it to computer’s answer it is decided that who has won the game.

22
REFERENCES

1. "Python Crash Course" by Eric Matthes - This book provides a comprehensive


introduction to Python programming, covering basic to advanced concepts with
practical examples and exercises.
2. "Automate the Boring Stuff with Python" by Al Sweigart - This book offers
practical examples and projects for automating tasks using Python, making it a valuable
resource for your project.
3. Official Python Documentation (https://docs.python.org/) - The official Python
documentation provides detailed information about the Python programming language,
including tutorials, guides, and references for various modules and functions.
4. Real Python website (https://realpython.com/) - Real Python offers tutorials,
articles, and resources for Python developers of all skill levels, covering a wide range
of topics from basics to advanced techniques.
5. GeeksforGeeks website (https://www.geeksforgeeks.org/python-programming-
language/) - GeeksforGeeks provides tutorials, articles, and coding challenges related
to Python programming, making it a useful resource for learning and reference.
6. Python.org (https://www.python.org/) - The official website of the Python
programming language offers documentation, tutorials, and community resources that
can be helpful for your project
7. GitHub repositories - Explore GitHub repositories related to Python projects similar
to yours. You can find code samples, project templates, and libraries that can be
referenced in your report.
8. Stack Overflow (https://stackoverflow.com/) - Stack Overflow is a popular Q&A
platform where you can find answers to various programming questions, including
Python-related queries. You can reference specific threads or solutions that helped you
in your project.
9. Medium articles - Search for Python-related articles on Medium, where you can find
tutorials, guides, and case studies that can provide insights and inspiration for your
project report.

23
APPENDICES
6.1 Project
Source code for the hence made project is-
import random
while True:
my_answer = input("Choose the answer : snake,water,gun, : ")
if my_answer != "snake" and my_answer != "water" and my_answer != "gun":
print("Please choose the correct option")
continue
computer_answer = random.choice(["snake","water","gun"])
print(f"Computer chooses : {computer_answer}")
if my_answer = computer_answer:
print("YOU TIED")
elif my_answer = "snake" and computer_answer == "water":
print("YOU WON")
elif my_answer = "water" and computer_answer == "gun":
print("YOU WON")
elif my_answer = "gun" and computer_answer == "snake":
print("YOU WON")
else:
print("YOU LOSE , TRY AGAIN")
my_answer = input("do you want play again : yes , no : ")
if my_answer != "yes":
print("YOU DO NOT WANT TO PLAY THEN IT IS OKAY")
break

6.2 Output

Output of the source code is-

Choose the answer : snake,water,gun, : water


Computer chooses : gun
YOU WON
do you want play again : yes , no : no
YOU DO NOT WANt TO PLAY THEN IT IS OKAY

24

You might also like