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

Python CA1 12313955

This document contains an assignment submitted by Deepak Thakur to Vikas Budhani. The assignment contains questions on Python programming concepts like identifiers, keywords, comments, variables, data types, operators, conditional statements, strings, lists, dictionaries, and tuples. Deepak provides answers to the questions on valid and invalid identifiers, declaring variables of different data types, a Python script to check if a number is positive, negative or zero, string operations like accessing characters and slicing, creating and modifying a dictionary, and basic operations on tuples.

Uploaded by

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

Python CA1 12313955

This document contains an assignment submitted by Deepak Thakur to Vikas Budhani. The assignment contains questions on Python programming concepts like identifiers, keywords, comments, variables, data types, operators, conditional statements, strings, lists, dictionaries, and tuples. Deepak provides answers to the questions on valid and invalid identifiers, declaring variables of different data types, a Python script to check if a number is positive, negative or zero, string operations like accessing characters and slicing, creating and modifying a dictionary, and basic operations on tuples.

Uploaded by

GAGAN SINGH
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 10

BUSINESS

ANALYTICS-I
[
C
A
-
1
]

Course Code MGNM801


Course Title BUSINESS ANALYTICS-I
Academic Task No. 01
Submitted To VIKAS BUDHANI
Assignment Submitted By DEEPAK THAKUR
Student Reg. No 12322655
Roll no RQ2346A06gag
Date of allotment 09/11/2023
Date of submission 16/11/2023
Unit – 1

Parts of Python Programming Language

Q1 Identifiers, Keywords, and Comments:


1. Choose three different identifiers and explain whether they are valid or not. Justify
your answer.

Answer –

1. variable_name (Valid Identifier)

Explanation:

This is a valid identifier. It follows the rules for naming variables in Python. It starts
with a letter (or underscore) and is followed by letters, underscores, or digits.

2. _deepak (Valid Identifier)

Explanation:

This is a valid identifier. Identifiers can start with a underscore in Python. They must
begin with a letter or an underscore.
3. continue (Invalid Identifier)

Explanation:

This is an invalid identifier. As keywords cannot be used as an Identifiers.

4. $variable (Invalid Identifiers)

Explanation:
This is an invalid identifier. Identifiers cannot start with a special character in Python.
They must begin with a letter or an underscore.

Q2 Variables, Operators, and Data Types


1. Declare a variable of each of the following data types: integer, float, string, and
boolean. Initialize them with sample values.
1. Integer
2. Float

3. String

4. Boolean
Q3 Indentation and Statements
Write a Python script with conditional statements (if, elif, else) to check if a given
number is positive, negative, or zero.
Unit – 2
Strings and Lists
Q1 Basic String Operations:

1. Create a string variable containing your full name.

Q2 Accessing Characters in a String:


1. Use indexing to print the last character of your name.
Q3 String Slicing and Joining:
1. Use the split() method to split the string into words and store them in a list. Then join
the words with a hyphen (-) and print the result.

Unit – 3
Part 1: Dictionaries
1) Creating a Dictionary:

Create a dictionary named “student_info” with the following key-value pairs:


“name,” “age,” “grade,” and “city.”

Here is the Python code to create a dictionary named


“student_info” with the following key-value pairs: “name,” “age,” “grade,” and “city”:

2) Accessing and Modifying Key-Value Pairs:

Modify the "city" value to represent a new city, and print the updated
dictionary.

Here is the Python code to modify the "city" value to represent a new city, and print
the updated dictionary.
Part 2: Tuples
1) Creating Tuples:

Create a tuple named "months" with the names of the twelve


months of the year:
Here is the Python code to create a tuple named "weeks" with the names of the seven days of
the week:

2) Basic Tuple Operations:

Check if a specific month is present in the tuple and print the result.

Here is the Python code to check if a specific month is present in the tuple and print
the result:
THANKYOU

You might also like