0% found this document useful (0 votes)
6 views

Python Random Joke

Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

Python Random Joke

Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 22

GOVERNMENT POLYTECHNIC

ADITYAPUR
SUMMER INTERNSHIP
ON
PYTHON PROGRAMMING

SUBMITTED BY

ELECTRICAL
ENGINEERING

Government Polytechnic, Adityapur


CONTENTS

• WEEKLY OVERVIEW
• SOFTWARE REQUIREMENTS
• PROJECT OVERVIEW
• CHALLENGES FACED
• FUTURE OUTLOOK
• CONCLUSION

Government Polytechnic, Adityapur


WEEKLY
OVERVIE
W

Government Polytechnic, Adityapur


PYTHON

Government Polytechnic, Adityapur


[May 27 - May Introduction to loops in Implemented basic loops
2 Monday for, while loops
31] Python in Python

Types of loops and loop break, continue, pass Mastered loop control
Tuesday
control statements statements statements

Implemented nested
Wednesday Nested loops in Python Nested loop structures
loops

Introduction to Git and Initialized Git repository


Thursday Version control basics
GitHub for projects

Defining and calling Implemented functions in


Friday Functions in Python
functions Python

Government Polytechnic, Adityapur


Government Polytechnic, Adityapur
Government Polytechnic, Adityapur
Government Polytechnic, Adityapur
SOFTWARE
USED

• Operating
System :-
Windows
• Python :-
• Python 3.12(32 bit)

Government Polytechnic, Adityapur


Project Overview
Project Overview :- The objective of the
project was to develop a “Jokes API." This
title :- Jokes provides funny jokes from the internet
about pop culture, science, history and
API other awesome topics.

Project
Description :- Joke API
is a API that serves uniformly
and well-formatted jokes. It can
be used without any API token,
membership, registration or
payment. It supports a variety of
filters that can be applied to get
just the right jokes needed.

Government Polytechnic, Adityapur


TECHNOLOGIES AND TOOLS USED

 Programming language :- Python

 Development Environment :- PYTHON 3.12(32 bit)

 Libraries and Packages :- Random for random role assignment

Government Polytechnic, Adityapur


CODES description

This Python program is designed to fetch a random joke from the "Official
Joke API" and print it to the console. The program makes use of the requests
library to handle HTTP requests and process the response from the API.
Below is a detailed explanation of each part of the program:

Importing the Required Library:

import requests: This line imports the requests library, which is necessary
for making HTTP requests to the API.

Government Polytechnic, Adityapur


EXPLAINATI
ON
Defining the get_random_joke Function:

url = "https://official-joke-api.appspot.com/random_joke": Specifies the API endpoint for fetching a random joke.

response = requests.get(url): Sends a GET request to the API endpoint and stores the response.

response.raise_for_status(): Raises an HTTPError if the HTTP request returned an unsuccessful status code.

joke = response.json(): Parses the JSON response and stores it in the joke variable.

return f"{joke['setup']} - {joke['punchline']}": Formats the joke as a string and returns it.

The try block handles any exceptions that might occur during the request and parsing process. If an exception occurs, it is
caught and an error message is returned.

Government Polytechnic, Adityapur


MAIN BLOC
K
if __name__ == "__main__":
joke = get_random_joke()
print(joke)

This block checks if the script is


being run directly (not imported as a
module) and, if so, calls the
get_random_joke function and
prints the returned joke

Government Polytechnic, Adityapur


HOW TO USE
THE PROGRAM
• Install the requests Library:
Make sure you have the
requests library installed. You
can install it using pip:
• Run the Program: Save the
program to a file (e.g.,
random_joke.py) and run it
using Python:

Government Polytechnic, Adityapur


install Requests
Module using
pip on command
prompt

Government Polytechnic, Adityapur


PROGRA
M

Government Polytechnic, Adityapur


OUTPUT
OF PROG
RAM COD
E

Government Polytechnic, Adityapur


CHALLENGES FACED
• Use case propagation
Traditional UI testing is limited to the testing functionality of the overall application.
• Access to connected systems
APIs pull data from multiple APIs and back-end systems, in which the resulting architecture looks like the roots of a tree
extending wide and deep. Thus, it’s impossible to have access to every environment on this tree.
• Synchronous and asynchronous methods
Modern applications are intricate, and one API can link several microservices and other APIs. Accordingly, a single call on an
API can prompt ‘n’ number of serial and parallel activities. The intricacies of an API can thus grow exponentially as it is
combined with other API calls.
• API versioning
The API must identify missing values and allocate some default to allow the old version to work.
• Compiler Errors
Often beginners panic when they have to perform other tasks as well as write codes. This leads to many compiler errors once
the code is executed.
• Code debugging
For a Python developer who has just started out, syntax can be quite complicated. A beginner is prone to make mistakes, and
this reduces as they gain experience. Debugging is an important component of the learning process as it makes them aware
about the problems that they may face later on.

Government Polytechnic, Adityapur


FUTURE OUTLOOK
Moving forward, I am enthusiastic about exploring and pursuing opportunities in the field of software
development, particularly in game development. Here are my key areas of focus for the future:
1. Software Engineering Practices: I intend to solidify my understanding of software engineering principles
by adopting best practices in software design, testing methodologies, and version control systems. This will
ensure that I can develop robust, scalable, and maintainable applications.
2. Continuous Learning: The dynamic nature of technology requires continuous learning. I am committed to
staying updated with the latest industry trends, tools, and frameworks. This includes attending workshops,
participating in online courses, and contributing to open-source projects to broaden my skill set.
3. Professional Growth: As I progress in my career, I aspire to take on roles that challenge me to innovate and
lead projects from inception to deployment. I aim to contribute to cutting-edge developments in the gaming
industry, leveraging my passion for creating immersive and engaging user experiences.

Government Polytechnic, Adityapur


CONCLUSIO
NVS Code is a
Creating a Joke API in Python using
rewarding learning experience that blends coding
proficiency with game design principles. It
enhances skills in logic building, user interface
development, and problem-solving. Aspiring
developers can leverage this project to pursue
careers in game development, software
engineering, AI integration, educational content
creation, entrepreneurship, UX design, game
testing, community management, mobile app
development, or project management within the
gaming.

Government Polytechnic, Adityapur


Government Polytechnic, Adityapur

You might also like