Lab_01_Basic_Constructs_of_Python
Lab_01_Basic_Constructs_of_Python
Learning Outcomes:
After this experiment, the understudy will be able to •
Setting up the developer environment in
python
• Explain the basic syntax of python language.
• Understand the basic constructs of python language
Required Software:
• Python 3.13.1, Visual Studio Code (VS Code)
Introduction to Artificial Intelligence and Python Language
Artificial Intelligence (AI) is the branch of computer science focused on creating systems capable of performing
tasks that typically require human intelligence. These tasks include learning from data, understanding natural
language, recognizing patterns, making decisions, and even simulating human emotions. AI encompasses
various subfields, such as machine learning, neural networks, and natural language processing. It is used in a
wide range of applications, from self-driving cars and virtual assistants to recommendation systems and
medical diagnostics. With ongoing advancements, AI is transforming industries and has the potential to
revolutionize how we interact with technology in everyday life.
Python is one of the most popular programming languages for developing Artificial Intelligence (AI)
applications due to its simplicity, versatility, and rich ecosystem of libraries and frameworks. Python is an
excellent choice for both beginners and experienced programmers. One of its key features is its ease of learning,
making it ideal for people who are new to coding. Python is also an interpreted language, meaning that it
executes code line by line, which simplifies debugging and testing. Additionally, it is dynamically typed,
meaning variables don’t need explicit declarations of their types, allowing for more flexible and faster
development. Additionally, Python’s ability to handle large datasets efficiently, combined with its robust
integration with other technologies, makes it a go-to language for developing AI solutions. From building
predictive models and recommendation systems to training autonomous systems, Python’s tools and
frameworks play a crucial role in shaping the future of AI.
Python’s widespread use in a variety of domains, including artificial intelligence, automation, and data analysis,
demonstrates its flexibility and power. The language’s open-source nature, combined with an active
community, means that there is always a wealth of resources, tutorials, and third-party libraries available to
assist developers. Its ease of use, coupled with its ability to scale for more complex applications, makes Python
an excellent language for rapid prototyping and full-fledged software development. Whether you're interested
2. Create a list of 5 numbers. The first two numbers are your batch and other three numbers are your roll
no. Find the sum and average of the numbers. Add a new number to the list by adding last two digits
of your roll no and print the updated list.
3. Create a dictionary with 3 key-values pairs where the keys are “name”, “age”, and “roll no”. Print the
value associated with the “name” key. Update the age and print the updated dictionary.
4. Create two sets. Perform the union and intersection of both sets.
5. Write a python program that takes two string as input (name and roll no) and concatenates the string
and print the result.
6. Write a python program that takes two numbers as input from user and prints the difference, product
and quotient. The two numbers should be your roll no.
7. Create a list of numbers from 1 to 10 and prints the first 3 numbers of the list.
8. Write a python program that takes a string as input and print how many times the letter “z” appears in
the string.
9. Given a list of fruits of your choice. Write a python program that accesses and print first and last fruit
from the list.