Repository navigation
Expand file tree
/
Copy path008-String-Data-Type.py
More file actions
79 lines (65 loc) · 3.46 KB
/
Copy path008-String-Data-Type.py
File metadata and controls
79 lines (65 loc) · 3.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
"""
===============================================================================
String Data Type
===============================================================================
Program Description:
--------------------
This program demonstrates the String (str) data type in Python.
A string is a sequence of characters enclosed within single quotes (' '),
double quotes (" "), or triple quotes (''' ''' / """ """).
Strings are used to store textual data such as names, addresses,
sentences, and messages.
Author : Shaik Mahaboob Basha
Repository : 13-Python
File Name : 08-String-Data-Type.py
===============================================================================
"""
# -----------------------------------------------------------------------------
# Creating a string variable named student_name.
# The variable stores the name of a student.
# -----------------------------------------------------------------------------
student_name = "Shaik Mahaboob Basha"
# student_name contains the string "Shaik Mahaboob Basha".
# -----------------------------------------------------------------------------
# Creating a string variable named course.
# The variable stores the course name.
# -----------------------------------------------------------------------------
course = "Python Programming"
# course contains the string "Python Programming".
# -----------------------------------------------------------------------------
# Creating a string variable named college.
# The variable stores the college name.
# -----------------------------------------------------------------------------
college = "XYZ Engineering College"
# college contains the string "XYZ Engineering College".
# -----------------------------------------------------------------------------
# Displaying the value stored in student_name.
# -----------------------------------------------------------------------------
print("Student Name :", student_name)
# Output: Student Name : Shaik Mahaboob Basha
# -----------------------------------------------------------------------------
# Displaying the value stored in course.
# -----------------------------------------------------------------------------
print("Course :", course)
# Output: Course : Python Programming
# -----------------------------------------------------------------------------
# Displaying the value stored in college.
# -----------------------------------------------------------------------------
print("College :", college)
# Output: College : XYZ Engineering College
# -----------------------------------------------------------------------------
# Displaying the data type of student_name.
# type() is a built-in function used to identify the data type of a variable.
# -----------------------------------------------------------------------------
print("Data Type of student_name :", type(student_name))
# Output: Data Type of student_name : <class 'str'>
# -----------------------------------------------------------------------------
# Displaying the data type of course.
# -----------------------------------------------------------------------------
print("Data Type of course :", type(course))
# Output: Data Type of course : <class 'str'>
# -----------------------------------------------------------------------------
# Displaying the data type of college.
# -----------------------------------------------------------------------------
print("Data Type of college :", type(college))
# Output: Data Type of college : <class 'str'>