Skip to content

Ilm o Irfan

Technologies

  • Home
  • Courses
    • Free Courses
  • Motivational Seminars
  • Blog
  • Books
  • Contact
  • Home
  • Courses
    • Free Courses
  • Motivational Seminars
  • Blog
  • Books
  • Contact
Explore Courses

Introduction to Python

  • August 24, 2022
  • Home
  • Free Book

Table of Contents

Chapter 5 - Constant in Python

  • Authors
  • Ms. Samavi Salman
  • Dr. Rao Muhammad Adeel Nawab
  • Supporting Material
  • Download Supporting Material (Code): here

Quick Recap

  • Quick Recap – Introduction to Authors and Book
  • In previous Chapter, I presented
    • How to use the power of smile and appreciation to stay happy and motivated?
    • How to achieve excellence in both Technical Skills and Human Engineering through this course?
    • A brief introduction of the instructor of the course
    • Course contents, course aims and course learning outcomes
    • Course development and teaching methodology

Constants

  • Constants
  • Definition
    • Constants are defined as those (Data) Values that do not change (i.e., remain the same) every time a Python Program is executed
  • Examples – Constants
  • Example 1 – A String Constant
    • Hazrat Muhammad S.A.W.W.
  • Example 2 – An Integer Constant
    • 7
  • Example 3 – A Float Constant
    • 86
  • Only Change is Constant
  • My Respected Teacher said
    • The only thing that is Constant in this world is
      • Change
    • Always! Be Kind. Always! Be Humble.
      • If you are Strong, Wealthy and Powerful Today, then don’t Oppress the Weak / Poor / Needy People
        • Very Soon, Time will Change, and you will also be Weak Poor and Powerless
      • Always Remember!
        • All praise is for Almighty Allah, who has control over everything

Types of Constants

  • Types of Constants
  • Two main broad categories of Constants are
    • Numeric Constants
    • String Constants
  • Types of Numeric Constants
  • The two main types of Numeric Constants are
    • Integer Constants
    • Float Constants
  • Integer Constants
  • Definition
    • Integer Constants are defined as those (Integer) Values that do not change (i.e., remain the same) every time a Python Program is executed
  • Purpose
    • The main purpose of the Integer Constants is to
      • Represent Integral Values
  • Important Note
    • An Integer Constant
      • Must have at least One Digit
      • Cannot have a Decimal Point
      • Can be either Positive or Negative
        • By default, an Integer Constant is Positive
  • Examples - Integer Constants
  • Example 1
    • 0
  • Example 2
    • -7
  • Example 3
    • 571
  • Example 4
    • -1000
  • Example 5
    • 2000000
  • Example 6
    • -9000000
  • Float Constants
  • Definition
    • Float Constants are defined as those (Float) Values that do not change (i.e., remain the same) every time a Python Program is executed
  • Purpose
    • The main purpose of the Float Constants is to
      • Represent Floating-Point Values
  • Important Note
    • A Float Constant
      • Must have
        • An Integer (before the Decimal Point)
        • A Decimal Point
        • A Fractional Part (after the Decimal Point)
      • Can be either Positive or Negative
        • By default, a Float Constant is Positive
  • Example – Three Parts of a Float Constant
  • Consider the following Float Constant
    • 86
  • Part 1 – Integer (before the Decimal Point)
    • 3
  • Part 2 – Decimal Point
    • .
  • Part 3 – Fractional Part (after the Decimal Point)
    • 86
  • Examples - Float Constants
  • Example 1
    • 5
  • Example 2
    • – 0.25
  • Example 3
    • =   = 0.25
  • Example 4
    • – 25.00
  • Example 5
    • = 0.01

Printing Integer Constants (or Integer Values) on Output Screen

  • Important Note
  • For all the Tasks in this Chapter, In Sha Allah, the Concepts studied in the previous Chapter may also be used including
    • print() Function
      • To Display Textual Data on the Output Screen
    • IPython Module
      • To Display Image, Video and Audio Data on the Output Screen
    • Escape Sequences
      • To Improve overall Formatting of the Data to be displayed on the Output Screen
  • For details on print() Function, IPython Library and Escape Sequences
    • See Chapter 4 – Basics of Python

Example 1 – Printing Integer Constants (or Integer Values) on Output Screen

  • Task 1
Completely and Correctly Understand the Task
  • Task Description
    • Write a Program in Python which prints the Integer Number in the Text given below as an Integer Constant on the Output Screen.
  • Required Output
    • Allah created heavens and earth in 7 days
Plan and Design Solution to the Task
  • Input-Processing-Output
    • Input
      • Data
        • An Integer Constant (or Integer Number)
      • Instruction(s)
        • Display Text Message along with the Integer Constant on the Output Screen
    • Output
      • Text Message along with Integer Constant is displayed on the Output Screen
    • Processing
      • Use print() Function
Implementation in Python
				
					'''
__author__ = Ms. Samavi Salman
__copyright__= Copyright (C) 2020 Ms. Samavi Salman
__license__ = Public Domain
__version__ = 1.0
'''

# Input + Processing + Output
print(Allah created heavens and earth", 7 , "days")
				
			
				
					Allah created heavens and earth in 7 days
				
			
Analysis, Main Findings and Conclusions
  • Analysis of Python Program
    • In this Python Program, I displayed a Text Message along with an Integer Constant (i.e., 7) on the Output Screen using
      • print() Function
  • Main Findings
    • Alhamdulillah (الحمدللہ) 😊, print() Function efficiently and effectively performed my required Task i.e.,
      • Displaying a Text Message along with an Integer Constant (i.e., 7) on the Output Screen
  • Conclusions
    • To conclude, our main goal i.e.,
      • Displaying a Text Message along with an Integer Constant (i.e., 7) on the Output Screen was successfully accomplished using print() Function. Alhamdulillah (الحمدللہ) 😊

Example 2 – Printing Integer Constants (or Integer Values) on Output Screen

  • Task 2
Completely and Correctly Understand the Task
  • Task Description
    • Write a Program in Python which prints the Integer Number in the Text given below as an Integer Constant on the Output Screen.
  • Required Output
    • Hazrat Muhammad S.A.W.W. performed only 1 Hajj
Plan and Design Solution to the Task
  • Input-Processing-Output
    • Input
      • Data
        • An Integer Constant (or Integer Number) 
      • Instruction(s)
        • Display Text Message along with the Integer Constant on the Output Screen
    • Output
      • Text Message along with Integer Constant is displayed on the Output Screen
    • Processing
      • Use print() Function
Implementation in Python
				
					'''
__author__   = Ms. Samavi Salman
__copyright__= Copyright (C) 2020 Ms. Samavi Salman
__license__  = Public Domain
__version__  = 1.0
'''

# Input + Processing + Output

print("Hazrat Muhammad S.A.W.W. performed only", 1 , "Hajj")

				
			
				
					Hazrat Muhammad S.A.W.W. performed only 1 Hajj
				
			
Analysis, Main Findings and Conclusions
  • Analysis of Python Program
    • In this Python Program, I displayed a Text Message along with an Integer Constant (i.e., 1) on the Output Screen using
      • print() Function
  • Main Findings
    • Alhamdulillah (الحمدللہ) 😊, print() Function efficiently and effectively performed my required Task i.e.,
      • Displaying a Text Message along with an Integer Constant (i.e., 1) on the Output Screen
  • Conclusions
    • To conclude, our main goal i.e.,
      • Displaying a Text Message along with an Integer Constant (i.e., 1) on the Output Screen was successfully accomplished using print() Function. Alhamdulillah (الحمدللہ) 😊

Example 3 – Printing Integer Constants (or Integer Values) on Output Screen

  • Task 3
Completely and Correctly Understand the Task
  • Task Description
    • Write a Program in Python which prints the Integer Number in the Text given below as an Integer Constant on the Output Screen.
  • Required Output
    • 5 times Namaz (everyday) is obligatory on every adult Muslim man and woman
Plan and Design Solution to the Task
  • Input-Processing-Output
    • Input
      • Data
        • An Integer Constant (or Integer Number) 
      • Instruction(s)
        • Display Text Message along with the Integer Constant on the Output Screen
    • Output
      • Text Message along with Integer Constant is displayed on the Output Screen
    • Processing
      • Use print() Function
Implementation in Python
				
					'''
__author__   = Ms. Samavi Salman
__copyright__= Copyright (C) 2020 Ms. Samavi Salman
__license__  = Public Domain
__version__  = 1.0
'''

# Input + Processing + Output

print(5, "times Namaz (everyday) is obligatory on every adult Muslim man and woman")
				
			
				
					5 times Namaz (everyday) is obligatory on every adult Muslim man and woman
				
			
Analysis, Main Findings and Conclusions
  • Analysis of Python Program
    • In this Python Program, I displayed a Text Message along with an Integer Constant (i.e., 5) on the Output Screen using
      • print() Function
  • Main Findings
    • Alhamdulillah (الحمدللہ) 😊, print() Function efficiently and effectively performed my required Task i.e.,
      • Displaying a Text Message along with an Integer Constant (i.e., 5) on the Output Screen
  • Conclusions
    • To conclude, our main goal i.e.,
      • Displaying a Text Message along with an Integer Constant (i.e., 5) on the Output Screen was successfully accomplished using print() Function. Alhamdulillah (الحمدللہ)😊

Example 4 – Printing Integer Constants (or Integer Values) on Output Screen

  • Task 4
Completely and Correctly Understand the Task
  • Task Description
    • Write a Program in Python which prints the Integer Numbers in the Text given below as Integer Constants on the Output Screen.
  • Required Output
    • Hazrat Muhammad S.A.W.W. was born on 9 Rabi-ul-Awal 571
Plan and Design Solution to the Task
  • Input-Processing-Output
    • Input
      • Data
        • Integer constant 1 (i.e., 9)
        • Integer constant 2 (i.e., 571)
      • Instruction(s)
        • Display Text Message along with the Integer Constant on the Output Screen
    • Output
      • Text Message along with Integer Constant is displayed on the Output Screen
    • Processing
      • Use print() Function
Implementation in Python
				
					'''
__author__   = Ms. Samavi Salman
__copyright__= Copyright (C) 2020 Ms. Samavi Salman
__license__  = Public Domain
__version__  = 1.0
'''

# Input + Processing + Output

print("Hazrat Muhammad S.A.W.W. was born on" , 9,  "Rabi-ul-Awal", 571)
				
			
				
					Hazrat Muhammad S.A.W.W. was born on 9 Rabi-ul-Awal 571
				
			
Analysis, Main Findings and Conclusions
  • Analysis of Python Program
    • In this Python Program, I displayed a Text Message along with Integer Constants (i.e., 9 and 571) on the Output Screen using
      • print() Function
  • Main Findings
    • Alhamdulillah (الحمدللہ) 😊, print() Function efficiently and effectively performed my required Task i.e.,
      • Displaying a Text Message along with Integer Constants (i.e., 9 and 571) on the Output Screen
  • Conclusions
    • To conclude, our main goal i.e.,
      • Displaying a Text Message along with Integer Constants (i.e., 9 and 571) on the Output Screen was successfully accomplished using print() Function. Alhamdulillah (الحمدللہ) 😊

Example 5 – Printing Integer Constants (or Integer Values) on Output Screen

  • Task 5
Completely and Correctly Understand the Task
  • Task Description
    • Write a Program in Python which prints the Integer Numbers in the Text given below as Integer Constants on the Output Screen.
  • Required Output
    • Hazrat Muhammad S.A.W.W. migrated to Madina from Makkah on 1 Rabi-ul-Awal 622
Plan and Design Solution to the Task
  • Input-Processing-Output
    • Input
      • Data
        • Integer constant 1 (i.e., 1)
        • Integer constant 2 (i.e., 622)
      • Instruction(s)
        • Display Text Message along with the Integer Constant on the Output Screen
    • Output
      • Text Message along with Integer Constant is displayed on the Output Screen
    • Processing
      • Use print() Function
Implementation in Python
				
					'''
__author__   = Ms. Samavi Salman
__copyright__= Copyright (C) 2020 Ms. Samavi Salman
__license__  = Public Domain
__version__  = 1.0
'''

# Input + Processing + Output

print("Hazrat Muhammad S.A.W.W. migrated to Madina from Makkah on", 1 , "Rabi-ul-Awal", 622)
				
			
				
					Hazrat Muhammad S.A.W.W. migrated to Madina from Makkah on 1 Rabi-ul-Awal 622
				
			
Analysis, Main Findings and Conclusions
  • Analysis of Python Program
    • In this Python Program, I displayed a Text Message along with Integer Constants (i.e., 1 and 622) on the Output Screen using
      • print() Function
  • Main Findings
    • Alhamdulillah (الحمدللہ) 😊, print() Function efficiently and effectively performed my required Task i.e.,
      • Displaying a Text Message along with Integer Constants (i.e., 1 and 622) on the Output Screen
  • Conclusions
    • To conclude, our main goal i.e.,
      • Displaying a Text Message along with Integer Constants (i.e., 1 and 622) on the Output Screen was successfully accomplished using print() Function. Alhamdulillah (الحمدللہ) 😊

Example 6 – Printing Integer Constants (or Integer Values) on Output Screen

  • Task 6
Completely and Correctly Understand the Task
  • Task Description
    • Write a Program in Python which prints the Integer Numbers in the Text given below as Integer Constants on the Output Screen.
  • Required Output
    • Hazrat Muhammad S.A.W.W. died on 12 Rabi-ul-Awal 632
Plan and Design Solution to the Task
  • Input-Processing-Output
    • Input
      • Data
        • Integer constant 1 (i.e., 12)
          Integer constant 2 (i.e., 632)
      • Instruction(s)
        • Display Text Message along with the Integer Constant on the Output Screen
    • Output
      • Text Message along with Integer Constant is displayed on the Output Screen
    • Processing
      • Use print() Function
Implementation in Python
				
					'''
__author__   = Ms. Samavi Salman
__copyright__= Copyright (C) 2020 Ms. Samavi Salman
__license__  = Public Domain
__version__  = 1.0
'''

# Input + Processing + Output

print("Hazrat Muhammad S.A.W.W. died on", 12 , "Rabi-ul-Awal", 632)
				
			
				
					Hazrat Muhammad S.A.W.W. died on 12 Rabi-ul-Awal 632
				
			
Analysis, Main Findings and Conclusions
  • Analysis of Python Program
    • In this Python Program, I displayed a Text Message along with Integer Constants (i.e., 12 and 632) on the Output Screen using
      • print() Function
  • Main Findings
    • Alhamdulillah (الحمدللہ) 😊, print() Function efficiently and effectively performed my required Task i.e.,
      • Displaying a Text Message along with Integer Constants (i.e., 12 and 632) on the Output Screen
  • Conclusions
    • To conclude, our main goal i.e.,
      • Displaying a Text Message along with Integer Constants (i.e., 12 and 632) on the Output Screen was successfully accomplished using print() Function. Alhamdulillah (الحمدللہ) 😊

Example 7 – Printing Integer Constants (or Integer Values) on Output Screen

  • Task 7
Completely and Correctly Understand the Task
  • Task Description
    • Write a Program in Python which prints the Integer Numbers in the Text given below as Integer Constants on the Output Screen.
  • Required Output
    • On the Day of Judgement, either people will go into: (1) Paradise or (2) Hell.
Plan and Design Solution to the Task
  • Input-Processing-Output
    • Input
      • Data
        • Integer constant 1 (i.e., 1)
        • Integer constant 2 (i.e., 2)
      • Instruction(s)
        • Display Text Message along with the Integer Constant on the Output Screen
    • Output
      • Text Message along with Integer Constant is displayed on the Output Screen
    • Processing
      • Use print() Function
Implementation in Python
				
					'''
__author__   = Ms. Samavi Salman
__copyright__= Copyright (C) 2020 Ms. Samavi Salman
__license__  = Public Domain
__version__  = 1.0
'''

# Input + Processing + Output

print("On the Day of Judgment, either people will go into: (" + "1" + ") Paradise or (" + "2" + ") Hell.")
				
			
				
					On the Day of Judgement, either people will go into: (1) Paradise or (2) Hell.
				
			
Analysis, Main Findings and Conclusions
  • Analysis of Python Program
    • In this Python Program, I displayed a Text Message along with Integer Constants (i.e., 1 and 2) on the Output Screen using
      • print() Function
  • Main Findings
    • Alhamdulillah (الحمدللہ) 😊, print() Function efficiently and effectively performed my required Task i.e.,
      • Displaying a Text Message along with Integer Constants (i.e., 1 and 2) on the Output Screen
  • Conclusions
    • To conclude, our main goal i.e.,
      • Displaying a Text Message along with Integer Constants (i.e., 1 and 2) on the Output Screen was successfully accomplished using print() Function. Alhamdulillah (الحمدللہ) 😊

Example 8 – Printing Integer Constants (or Integer Values) on Output Screen

  • Task 8
Completely and Correctly Understand the Task
  • Task Description
    • Write a Program in Python which prints the Integer Numbers in the Text given below as Integer Constants on the Output Screen.
  • Required Output
    • The first four caliphs after death of our beloved Prophet Hazrat Muhammad S.A.W.W. are:
      1. Hazrat Abu Bakar Siddique R.A.
      2. Hazrat Umar ibn al-Khattab R.A
      3. Hazrat Usman ibn Affan R.A.
      4. Hazrat Ali ibn Abi Talib R.A
Plan and Design Solution to the Task
  • Input-Processing-Output
    • Input
      • Data
        • Integer constant 1 (i.e., 1)
          Integer constant 2 (i.e., 2)
          Integer constant 3 (i.e., 3)
          Integer constant 4 (i.e., 4)
      • Instruction(s)
        • Display Text Message along with the Integer Constant on the Output Screen
    • Output
      • Text Message along with Integer Constant is displayed on the Output Screen
    • Processing
      • Use print() Function
Implementation in Python
				
					'''
__author__   = Ms. Samavi Salman
__copyright__= Copyright (C) 2020 Ms. Samavi Salman
__license__  = Public Domain
__version__  = 1.0
'''

# Input + Processing + Output

print("On the Day of Judgment, either people will go into: (" + "1" + ") Paradise or (" + "2" + ") Hell.")
				
			
				
					The first four caliphs after death of our beloved Prophet Hazrat Muhammad S.A.W.W. are:
1. Hazrat Abu Bakar Siddique R.A.
2. Hazrat Umar ibn al-Khattab R.A
3. Hazrat Usman ibn Affan R.A.
4. Hazrat Ali ibn Abi Talib R.A
				
			
Analysis, Main Findings and Conclusions
  • Analysis of Python Program
    • In this Python Program, I displayed a Text Message along with Integer Constants (i.e., 1, 2, 3 and 4) on the Output Screen using
      • print() Function
  • Main Findings
    • Alhamdulillah (الحمدللہ) 😊, print() Function efficiently and effectively performed my required Task i.e.,
      • Displaying a Text Message along with Integer Constants (i.e., 1, 2, 3 and 4) on the Output Screen
  • Conclusions
    • To conclude, our main goal i.e.,
      • Displaying a Text Message along with Integer Constants (i.e., 1, 2, 3 and 4) on the Output Screen was successfully accomplished using print() Function. Alhamdulillah (الحمدللہ) 😊

Example 9 – Printing Integer Constants (or Integer Values) on Output Screen

  • Task 9
Completely and Correctly Understand the Task
  • Task Description
    • Write a Program in Python which prints the Integer Numbers in the Text given below as Integer Constants on the Output Screen.
  • Required Output
    • The first four Ghazwa are:
      1. Ghazwa.e.Badar
      2. Ghazwa.e.Auhad
      3. Ghazwa.e.Khandaq / Ghazwa Ahzab
      4. Ghazwa.e.Tabuq
Plan and Design Solution to the Task
  • Input-Processing-Output
    • Input
      • Data
        • Integer constant 1 (i.e., 1)
        • Integer constant 2 (i.e., 2)
        • Integer constant 3 (i.e., 3)
        • Integer constant 4 (i.e., 4)
      • Instruction(s)
        • Display Text Message along with the Integer Constant on the Output Screen
    • Output
      • Text Message along with Integer Constant is displayed on the Output Screen
    • Processing
      • Use print() Function
Implementation in Python
				
					'''
__author__   = Ms. Samavi Salman
__copyright__= Copyright (C) 2020 Ms. Samavi Salman
__license__  = Public Domain
__version__  = 1.0
'''

# Input + Processing + Output

print("The first four Ghazwa are:")
print(1,". Ghazwa.e.Badar ")
print(2,".  Ghazwa.e.Auhad ")
print(3,".  Ghazwa.e.Khandaq / Ghazwa Ahzab ")
print(4,".  Ghazwa.e.Tabuq ")
				
			
				
					The first four Ghazwa are:
1. Ghazwa.e.Badar
2. Ghazwa.e.Auhad
3. Ghazwa.e.Khandaq / Ghazwa Ahzab
4. Ghazwa.e.Tabuq
				
			
Analysis, Main Findings and Conclusions
  • Analysis of Python Program
    • In this Python Program, I displayed a Text Message along with Integer Constants (i.e., 1, 2, 3 and 4) on the Output Screen using
      • print() Function
  • Main Findings
    • Alhamdulillah (الحمدللہ) 😊, print() Function efficiently and effectively performed my required Task i.e.,
      • Displaying a Text Message along with Integer Constants (i.e., 1, 2, 3 and 4) on the Output Screen
  • Conclusions
    • To conclude, our main goal i.e.,
      • Displaying a Text Message along with Integer Constants (i.e., 1, 2, 3 and 4) on the Output Screen was successfully accomplished using print() Function. Alhamdulillah (الحمدللہ) 😊
  • Difference Between Normal Text in print() Function and Integer Constant
Code Fragments
  • Consider the following two Code Fragments
    • Code 1
      • print(“99 names of Allah”)
    • Output of Code 1
      • 99 names of Allah
    • Code 2
      • print(99, “names of Allah”)
    • Output of Code 2
      • 99 names of Allah
Analysis and Conclusions
  • Analysis of Python Program
    • Output of Code 1 is exactly same as Output of Code 2
      • However, in Code 1
        • 99 is a String
      • Whereas, in Code 2
        • 99 is an Integer Constant
Conclusions
  • Normal Text and Integer Constants in print() Function are treated differently

TODO and Your Turn

Todo Tasks
Your Turn Tasks
Todo Tasks

TODO Task 1

  • Task
    • Consider the following Tasks and answer the questions given below
  • Note
    • Your answer should be
      • Well Justified
  • Questions
    • Write Python Programs for all the Tasks given above by following the Template given in this Chapter i.e.,
      • Completely and Correctly Understand the Task
        • Task Description
        • Required Output
      • Plan and Design Solution of the Task
        • Input-Processing-Output
          • Input
            • Data
            • Instructions
          • Output
          • Processing
      • Implementation in Python
        • Code
        • Output of Code
      • Analysis, Main Findings and Conclusions
        • Analysis of Python Program
        • Main Findings
        • Conclusion

 

                                                                        Task 1

Completely and Correctly Understand the Task

Task Description

  • Write a Program in Python which prints the Integer Number in the Text given below as an Integer Constant on the Output Screen.

Required Output

There are 30 Paras in Quran.e.Pak

  

                                                                        Task 2

Completely and Correctly Understand the Task

Task Description

  • Write a Program in Python which prints the Integer Number in the Text given below as an Integer Constant on the Output Screen.

Required Output

There are 15 Sajdas in Quran.e.Pak

  

                                                                        Task 3

Completely and Correctly Understand the Task

Task Description

  • Write a Program in Python which prints the Integer Numbers in the Text given below as Integer Constants on the Output Screen.

Required Output

There are 86 Makki and 28 Madni Surah in in Quran.e.Pak

 

                                                                        Task 4

Completely and Correctly Understand the Task

Task Description

  • Write a Program in Python which prints the Integer Numbers in the Text given below as Integer Constants on the Output Screen.

Required Output

Hazrat Muhammad S.A.W.W. married Hazrat Amma Khadija R.A.at the age of 25 and She died when He (S.A.W.W.) was 50 years old

 

                                                                        Task 5

Completely and Correctly Understand the Task

Task Description

  • Write a Program in Python which prints the Integer Numbers in the Text given below as Integer Constants on the Output Screen.

Required Output

The names of children of Hazrat Muhammad S.A.W.W. are:

  1. Hazrat Qasim ibn Muhammad
  2. Hazrat Zainab bint Muhammad
  3. Hazrat Ruqayyah bint Muhammad
  4. Hazrat Umm Kulsum bint Muhammad
  5. Hazrat Fatima bint Muhammad
  6. Hazrat Abdullah ibn Muhammad
  7. Hazrat Ibrahim ibn Muhammad

                                                                        Task 6

Completely and Correctly Understand the Task

Task Description

  • Write a Program in Python which prints the Integer Numbers in the Text given below as Integer Constants on the Output Screen.

Required Output

The names of wives of Hazrat Muhammad S.A.W.W. are:

  1. Hazrat Amma Khadijah bint Khuwaylid R.A.
  2. Hazrat Amma Sawda bint Zamʿa R.A.
  3. Hazrat Amma Aisha bint Abu Bakr R.A.
  4. Hazrat Amma Hafsa bint Umar R.A.
  5. Hazrat Amma Zaynab bint Khuzayma R.A.
  6. Hazrat Amma Um Salamah R.A.
  7. Hazrat Amma Um Habeebah R.A.
  8. Hazrat Amma Juwayriyya bint Al Harith R.A.
  9. Hazrat Amma Maymunah bint Al Harith R.A.
  10. Hazrat Amma Safiyya bint Huyayy R.A.
  11. Hazrat Amma Zaynab bint Jahsh R.A.
Your Turn Tasks

Your Turn Task 1

  • Task
    • Write at least 10 different Tasks which are very similar to the ones given in the TODO Tasks
    • For each Task write a Python Program using the following Template mentioned in this Chapter i.e.,
  • Note
    • Your answer should be
      • Well Justified
  • Questions
    • Write Python Programs for all the Tasks given above by following the Template given in this Chapter i.e.,
      • Completely and Correctly Understand the Task
        • Task Description
        • Required Output
      • Plan and Design Solution of the Task
        • Input-Processing-Output
          • Input
            • Data
            • Instructions
          • Output
          • Processing
      • Implementation in Python
        • Code
        • Output of Code
      • Analysis, Main Findings and Conclusions
        • Analysis of Python Program
        • Main Findings
        • Conclusion

Printing Float Constants (or Float Values) on Output Screen

Example 1 - Printing Float Constants (or Float Values) on Output Screen

  • Task 1
Completely and Correctly Understand the Task
  • Task Description
    • Write a Program in Python which prints the Float Number in the Text given below as a Float Constant on the Output Screen.
  • Required Output
    • Zakat is 2.5% of a Muslim’s total savings
Plan and Design Solution to the Task
  • Input-Processing-Output
    • Input
      • Data
        • A Float Constant (or Float Number)
      • Instruction(s)
        • Display Text Message along with the Float Number on the Output Screen
    • Output
      • Text Message along with the Float Constant is displayed on the Output Screen
    • Processing
      • Use print() Function
Implementation in Python
				
					'''
__author__   = Ms. Samavi Salman
__copyright__= Copyright (C) 2020 Ms. Samavi Salman
__license__  = Public Domain
__version__  = 1.0
'''

# Input + Processing + Output

print("Zakat is", 2.5, "% of a Muslim's total savings")
				
			
				
					Zakat is 2.5% of a Muslim's total savings
				
			
Analysis, Main Findings and Conclusions
  • Analysis of Python Program
    • In this Python Program, I displayed a Text Message along with a Float Constant (i.e., 2.5) on the Output Screen using
      • print() Function
  • Main Findings
    • Alhamdulillah (الحمدللہ) 😊, print() Function efficiently and effectively performed my required Task i.e.,
      • Displayed a Text Message along with a Float Constant (i.e., 2.5) on Output Screen
  • Conclusions
    • To conclude, our main goal i.e.,
      • Displaying a Text Message along with a Float Constant (i.e., 2.5) on the Output Screen was successfully accomplished using print() Function. Alhamdulillah (الحمدللہ) 😊

Example 2 - Printing Float Constants (or Float Values) on Output Screen

  • Task 2
Completely and Correctly Understand the Task
  • Task Description
    • Write a Program in Python which prints the Float Number in the Text given below as a Float Constant on the Output Screen.
  • Required Output
    • The minimum Fitrana amount paid on Eid is fixed as Rs. 100.00 per person
Plan and Design Solution to the Task
  • Input-Processing-Output
    • Input
      • Data
        • A Float Constant (or Float Number)
      • Instruction(s)
        • Display Text Message along with the Float Number on the Output Screen
    • Output
      • Text Message along with the Float Constant is displayed on the Output Screen
    • Processing
      • Use print() Function
Implementation in Python
				
					'''
__author__   = Ms. Samavi Salman
__copyright__= Copyright (C) 2020 Ms. Samavi Salman
__license__  = Public Domain
__version__  = 1.0
'''

# Input + Processing + Output

print("The minimum Fitrana amount paid on Eid is fixed as Rs.", 100.00, "per person")
				
			
				
					The minimum Fitrana amount paid on Eid is fixed as Rs. 100.00 per person
				
			
Analysis, Main Findings and Conclusions
  • Analysis of Python Program
    • In this Python Program, I displayed a Text Message along with a Float Constant (i.e., 100.00) on the Output Screen using
      • print() Function
  • Main Findings
    • Alhamdulillah (الحمدللہ) 😊, print() Function efficiently and effectively performed my required Task i.e.,
      • Displayed a Text Message along with a Float Constant (i.e., 100.00) on Output Screen
  • Conclusions
    • To conclude, our main goal i.e.,
      • Displaying a Text Message along with a Float Constant (i.e., 100.00) on the Output Screen was successfully accomplished using print() Function. Alhamdulillah (الحمدللہ) 😊

Example 3 - Printing Float Constants (or Float Values) on Output Screen

  • Task 3
Completely and Correctly Understand the Task
  • Task Description
    • Write a Program in Python which prints the Float Number in the Text given below as a Float Constant on the Output Screen.
  • Required Output
    • If you give Sadqa of 10.5 rupees, the minimum amount that Allah will give you is: 10.0 x 10.5 = 105.0
Plan and Design Solution to the Task
  • Input-Processing-Output
    • Input
      • Data
        • Float constant 1 (i.e., 10.5)
          Float constant 2 (i.e., 10.0)
          Float constant 3 (i.e., 105.0)
      • Instruction(s)
        • Display Text Message along with the Float Numbers on the Output Screen
    • Output
      • Text Message along with the Float Constant is displayed on the Output Screen
    • Processing
      • Use print() Function
Implementation in Python
				
					'''
__author__   = Ms. Samavi Salman
__copyright__= Copyright (C) 2020 Ms. Samavi Salman
__license__  = Public Domain
__version__  = 1.0
'''

# Input + Processing + Output

print("If you give Sadqa of ", 10.5, "rupees, the minimum amount that Allah will give you is: ", 10.0, "x", 10.5, "=", 105.0)
				
			
				
					If you give Sadqa of 10.5 rupees, the minimum amount that Allah will give you is: 10.0 x 10.5 = 105.0
				
			
Analysis, Main Findings and Conclusions
  • Analysis of Python Program
    • In this Python Program, I displayed a Text Message along with a Float Constant (i.e., 10.5, 10.0 and 105.0) on the Output Screen using
      • print() Function
  • Main Findings
    • Alhamdulillah (الحمدللہ) 😊, print() Function efficiently and effectively performed my required Task i.e.,
      • Displayed a Text Message along with a Float Constant (i.e., 10.5, 10.0 and 105.0) on Output Screen
  • Conclusions
    • To conclude, our main goal i.e.,
      • Displaying a Text Message along with a Float Constant (i.e., 10.5, 10.0 and 105.0) on the Output Screen was successfully accomplished using print() Function. Alhamdulillah (الحمدللہ) 😊

Example 4 - Printing Float Constants (or Float Values) on Output Screen

  • Task 4
Completely and Correctly Understand the Task
  • Task Description
    • Write a Program in Python which prints the Float Number in the Text given below as a Float Constant on the Output Screen.
  • Required Output
    • Ushr is 10.0% on the harvests of irrigated land and 10.0% on harvest from rain-watered land and 5.0% on Land dependent on well water
Plan and Design Solution to the Task
  • Input-Processing-Output
    • Input
      • Data
        • Float constant 1 (i.e., 10.0)
        • Float constant 2 (i.e., 5.0)
      • Instruction(s)
        • Display Text Message along with the Float Numbers on the Output Screen
    • Output
      • Text Message along with the Float Constant is displayed on the Output Screen
    • Processing
      • Use print() Function
Implementation in Python
				
					'''
__author__   = Ms. Samavi Salman
__copyright__= Copyright (C) 2020 Ms. Samavi Salman
__license__  = Public Domain
__version__  = 1.0
'''

# Input + Processing + Output

print("Ushr is ", 10.0 , "% on the harvests of irrigated land and ", 10.0, "%  on harvest from rain-watered land and", 5.0 ," % on Land dependent on well water")
				
			
				
					Ushr is 10.0% on the harvests of irrigated land and 10.0% on harvest from rain-watered land and 5.0% on Land dependent on well water
				
			
Analysis, Main Findings and Conclusions
  • Analysis of Python Program
    • In this Python Program, I displayed a Text Message along with a Float Constant (i.e., 10.0 and 5.0) on the Output Screen using
      • print() Function
  • Main Findings
    • Alhamdulillah (الحمدللہ) 😊, print() Function efficiently and effectively performed my required Task i.e.,
      • Displayed a Text Message along with a Float Constant (i.e., 10.0 and 5.0) on Output Screen
  • Conclusions
    • To conclude, our main goal i.e.,
      • Displaying a Text Message along with a Float Constant (i.e., 10.0 and 5.0) on the Output Screen was successfully accomplished using print() Function. Alhamdulillah (الحمدللہ) 😊

Example 5 - Printing Float Constants (or Float Values) on Output Screen

  • Task 5
Completely and Correctly Understand the Task
  • Task Description
    • Write a Program in Python which prints the Float Number in the Text given below as a Float Constant on the Output Screen.
  • Required Output
    • Ms. Samavi has 10.0 Tola of Gold. The price of Gold per Tola is Rs. 100000.0. She will give Zakat of Rs. 25000.00.
Plan and Design Solution to the Task
  • Input-Processing-Output
    • Input
      • Data
        • Float constant 1 (i.e., 10.0)
        • Float constant 2 (i.e., 100000.0)
        • Float constant 3 (i.e., 25000.00)
      • Instruction(s)
        • Display Text Message along with the Float Numbers on the Output Screen
    • Output
      • Text Message along with the Float Constant is displayed on the Output Screen
    • Processing
      • Use print() Function
Implementation in Python
				
					'''
__author__   = Ms. Samavi Salman
__copyright__= Copyright (C) 2020 Ms. Samavi Salman
__license__  = Public Domain
__version__  = 1.0
'''

# Input + Processing + Output

print("Ms. Samavi has", 10.0 , "Tola of Gold. The price of Gold per Tola is Rs.", 100000.0, ".She will give Zakat of Rs.", 25000.00)
				
			
				
					Ms. Samavi has 10.0 Tola of Gold. The price of Gold per Tola is Rs. 100000.0. She will give Zakat of Rs. 25000.00.
				
			
Analysis, Main Findings and Conclusions
  • Analysis of Python Program
    • In this Python Program, I displayed a Text Message along with a Float Constant (i.e., 10.0, 100000.0 and 25000.00) on the Output Screen using
      • print() Function
  • Main Findings
    • Alhamdulillah (الحمدللہ) 😊, print() Function efficiently and effectively performed my required Task i.e.,
      • Displayed a Text Message along with a Float Constant (i.e., 10.0, 100000.0 and 25000.00) on Output Screen
  • Conclusions
    • To conclude, our main goal i.e.,
      • Displaying a Text Message along with a Float Constant (i.e., 10.0, 100000.0 and 25000.00) on the Output Screen was successfully accomplished using print() Function. Alhamdulillah (الحمدللہ) 😊
  • Difference Between Normal Text in print() Function and Float Constant
Code Fragments
  • Consider the following two Code Fragments
    • Code 1
      • print(“2.5% Zakat on Wealth purifies the Wealth”)
    • Output of Code 1
      • 5% Zakat on Wealth purifies the Wealth
    • Code 2
      • print(2.5, “% Zakat on Wealth purifies the Wealth”)
    • Output of Code 2
      • 2.5% Zakat on Wealth purifies the Wealth
Analysis and Conclusions
  • Analysis of Python Program
    • Output of Code 1 is exactly same as Output of Code 2
      • However, in Code 1
        • 5 is a String
      • Whereas, in Code 2
        • 2.5 is a Float Constant
Conclusions
  • Normal Text and Float Constants in print() Function are treated differently

TODO and Your Turn

Todo Tasks
Your Turn Tasks
Todo Tasks

TODO Task 1

  • Task
    • Consider the following Tasks and answer the questions given below
  • Note
    • Your answer should be
      • Well Justified
  • Questions
    • Write Python Programs for all the Tasks given above by following the Template given in this Chapter i.e.,
      • Completely and Correctly Understand the Task
        • Task Description
        • Required Output
      • Plan and Design Solution of the Task
        • Input-Processing-Output
          • Input
            • Data
            • Instructions
          • Output
          • Processing
      • Implementation in Python
        • Code
        • Output of Code
      • Analysis, Main Findings and Conclusions
        • Analysis of Python Program
        • Main Findings
        • Conclusion

 

                                                                        Task 1

Completely and Correctly Understand the Task

Task Description

  • Write a Program in Python which prints the Float Number in the Text given below as Float Constant on the Output Screen.

Required Output

Pakistan has the second largest number of Muslims in the world after Indonesia, with an estimated 174.5 million Muslims.

  

                                                                        Task 2

Completely and Correctly Understand the Task

Task Description

  • Write a Program in Python which prints the Float Number in the Text given below as Float Constant on the Output Screen.

Required Output

In 2016, the median age of Muslims throughout Europe was 30.4. Life is very short, do good deeds to please Allah.

  

                                                                        Task 3

Completely and Correctly Understand the Task

Task Description

  • Write a Program in Python which prints the Float Numbers in the Text given below as Float Constants on the Output Screen.

Required Output

In 2015, Islam had 1.8 billion adherents, making up about 24.1% of the world population. May Allah unite all the Muslims of the world so that they help, support and motivate one another Ameen.

  

                                                                        Task 4

Completely and Correctly Understand the Task

Task Description

  • Write a Program in Python which prints the Float Numbers in the Text given below as Float Constants on the Output Screen.

Required Output

Beauty of 0.0 is that if you multiply very huge number (say 1000000000.00) with it the result is 0.0. One day will be multiplied by Death (0.0) and we will have to give answers of our deeds to Allah.

  

                                                                        Task 5

Completely and Correctly Understand the Task

Task Description

  • Write a Program in Python which prints the Float Number in the Text given below as Float Constant on the Output Screen.

Required Output

If you have Rs. 100.00. When you give Sadqa of Rs. 15.00. Allah will give you minimum of Rs. 150.00 and maximum has no upper limit. Always make a habit to give Sadqa.

Your Turn Tasks

Your Turn Task 1

  • Task
    • Write at least 10 different Tasks which are very similar to the ones given in the TODO Tasks
    • For each Task write a Python Program using the following Template mentioned in this Chapter i.e.,
  • Note
    • Your answer should be
      • Well Justified
  • Questions
    • Write Python Programs for all the Tasks given above by following the Template given in this Chapter i.e.,
      • Completely and Correctly Understand the Task
        • Task Description
        • Required Output
      • Plan and Design Solution of the Task
        • Input-Processing-Output
          • Input
            • Data
            • Instructions
          • Output
          • Processing
      • Implementation in Python
        • Code
        • Output of Code
      • Analysis, Main Findings and Conclusions
        • Analysis of Python Program
        • Main Findings
        • Conclusion

String Constant

  • String
  • Definition
    • A String is defined as a Sequence of Characters
  • String Constants
  • Definition
    • String Constants are defined as those Fixed Sequence of Characters that do not change (i.e., remain the same) every time a Python Program is executed
  • Purpose
    • The main purpose of the Float Constants is to
      • Represent Fixed Sequence of Characters
  • Important Note
    • A String Constant may contain
      • Characters
      • Numbers (Integer and / or Float)
      • Special Characters (for e.g., $, #, @ etc.)
      • Punctuation Marks (for e.g., Full Stop, Comma etc.)
      • Spaces
  • Types of String Constants
  • The two main types of String Constants are
    • String Constant Comprising of a Single Character
    • String Constant Comprising of Multiple Characters
  • Examples - String Constant Comprising of a Single Character
  • Example 1
    • A
  • Example 2
    • $
  • Example 3
    • a
  • Example 4
    • @
  • Example 5
    • %
  • Examples - String Constant Comprising of Multiple Characters
  • Example 1
    • Allah
  • Example 2
    • Hazrat Muhammad (S.A.W.W.)
  • Example 3
    • Al-Masjid An-Nabawi, Al Haram, Madina 42311, Saudi Arabia
  • Example 4
    • Love and Respect the Humanity
  • Example 5
    • To learn any Task completely and correctly, First focus on Accuracy then on Speed

Printing String Constants on the Output Screen

Example 1 - Printing String Constants on the Output Screen

  • Task 1
Completely and Correctly Understand the Task
  • Task Description
    • Write a Program in Python which prints the following String in the Text given in Required Output as a String Constant on the Output Screen.
      • A
  • Required Output
    • My grade in Introduction to Python is: A
Plan and Design Solution to the Task
  • Input-Processing-Output
    • Input
      • Data
        • A String Constant (Comprising of a Single Character)
      • Instruction(s)
        • Display Text Message along with a String Constant on the Output Screen
    • Output
      • Text Message along with a String Constant is displayed on the Output Screen
    • Processing
      • Use print() Function
Implementation in Python
				
					'''
__author__   = Ms. Samavi Salman
__copyright__= Copyright (C) 2020 Ms. Samavi Salman
__license__  = Public Domain
__version__  = 1.0
'''

print("My grade in Introduction to Python is: " + "A")
				
			
				
					My grade in Introduction to Python is: A
				
			
Analysis, Main Findings and Conclusions
  • Analysis of Python Program
    • In this Python Program, I displayed a Text Message along with a String Constant (comprising of a Single Character i.e., A) on the Output Screen using
      • print() Function
  • Main Findings
    • Alhamdulillah (الحمدللہ) 😊, print() Function efficiently and effectively performed my required Task i.e.,
      • Displayed a Text Message along with a String Constant (comprising of a Single Character i.e., A) on the Output Screen
  • Conclusions
    • To conclude, our main goal i.e.,
      • Displaying a Text Message along with a String Constant (comprising of a Single Character i.e., A) on Output Screen was successfully accomplished using print() Function. Alhamdulillah (الحمدللہ) 😊

Example 2 - Printing String Constants on the Output Screen

  • Task 2
Completely and Correctly Understand the Task
  • Task Description
    • Write a Program in Python which prints the following String in the Text given in Required Output as a String Constant on the Output Screen.
      • 1
    • Required Output
      • There is only 1 Allah
Plan and Design Solution to the Task
  • Input-Processing-Output
    • Input
      • Data
        • A String Constant (Comprising of a Single Character)
      • Instruction(s)
        • Display Text Message along with a String Constant on the Output Screen
    • Output
      • Text Message along with a String Constant is displayed on the Output Screen
    • Processing
      • Use print() Function
Implementation in Python
				
					'''
__author__   = Ms. Samavi Salman
__copyright__= Copyright (C) 2020 Ms. Samavi Salman
__license__  = Public Domain
__version__  = 1.0
'''

# Input + Processing + Output

print("There is only", 1 ,"Allah")
				
			
				
					There is only 1 Allah
				
			
Analysis, Main Findings and Conclusions
  • Analysis of Python Program
    • In this Python Program, I displayed a Text Message along with a String Constant (comprising of a Single Character i.e., 1) on the Output Screen using
      • print() Function
  • Main Findings
    • Alhamdulillah (الحمدللہ) 😊, print() Function efficiently and effectively performed my required Task i.e.,
      • Displayed a Text Message along with a String Constant (comprising of a Single Character i.e., 1) on the Output Screen
  • Conclusions
    • To conclude, our main goal i.e.,
      • Displaying a Text Message along with a String Constant (comprising of a Single Character i.e., 1) on Output Screen was successfully accomplished using print() Function. Alhamdulillah (الحمدللہ) 😊

Example 3 - Printing String Constants on the Output Screen

  • Task 3
Completely and Correctly Understand the Task
  • Task Description
    • Write a Program in Python which prints the following String in the Text given in Required Output as a String Constant on the Output Screen.
      • %
    • Required Output
      • Zakat is 2.5% of your total savings.
Plan and Design Solution to the Task
  • Input-Processing-Output
    • Input
      • Data
        • A String Constant (Comprising of a Single Character)
      • Instruction(s)
        • Display Text Message along with a String Constant on the Output Screen
    • Output
      • Text Message along with a String Constant is displayed on the Output Screen
    • Processing
      • Use print() Function
Implementation in Python
				
					'''
__author__   = Ms. Samavi Salman
__copyright__= Copyright (C) 2020 Ms. Samavi Salman
__license__  = Public Domain
__version__  = 1.0
'''

# Input + Processing + Output

print("Zakat is", 2.5, "%", "of your total savings.")
				
			
				
					Zakat is 2.5% of your total savings.
				
			
Analysis, Main Findings and Conclusions
  • Analysis of Python Program
    • In this Python Program, I displayed a Text Message along with a String Constant (comprising of a Single Character i.e., %) on the Output Screen using
      • print() Function
  • Main Findings
    • Alhamdulillah (الحمدللہ) 😊, print() Function efficiently and effectively performed my required Task i.e.,
      • Displayed a Text Message along with a String Constant (comprising of a Single Character i.e., %) on the Output Screen
  • Conclusions
    • To conclude, our main goal i.e.,
      • Displaying a Text Message along with a String Constant (comprising of a Single Character i.e., %) on Output Screen was successfully accomplished using print() Function. Alhamdulillah (الحمدللہ) 😊

Example 4 - Printing String Constants on the Output Screen

  • Task 4
Completely and Correctly Understand the Task
  • Task Description
    • Write a Program in Python which prints the following String in the Text given in Required Output as a String Constant on the Output Screen.
      • $
      • =
    • Required Output
      • $1 = Rs. 150.00
Plan and Design Solution to the Task
  • Input-Processing-Output
    • Input
      • Data
        • A String Constant (Comprising of a Single Character)
      • Instruction(s)
        • Display Text Message along with a String Constant on the Output Screen
    • Output
      • Text Message along with a String Constant is displayed on the Output Screen
    • Processing
      • Use print() Function
Implementation in Python
				
					'''
__author__   = Ms. Samavi Salman
__copyright__= Copyright (C) 2020 Ms. Samavi Salman
__license__  = Public Domain
__version__  = 1.0
'''

# Input + Processing + Output

print("$",1, "=", "Rs.", 150.00)
				
			
				
					$1 = Rs. 150.00
				
			
Analysis, Main Findings and Conclusions
  • Analysis of Python Program
    • In this Python Program, I displayed a Text Message along with a String Constant (comprising of Single Characters i.e., $ and =) on the Output Screen using
      • print() Function
  • Main Findings
    • Alhamdulillah (الحمدللہ) 😊, print() Function efficiently and effectively performed my required Task i.e.,
      • Displayed a Text Message along with a String Constant (comprising of Single Characters i.e., $ and =) on the Output Screen
  • Conclusions
    • To conclude, our main goal i.e.,
      • Displaying a Text Message along with a String Constant (comprising of Single Characters i.e., $ and =) on Output Screen was successfully accomplished using print() Function. Alhamdulillah (الحمدللہ) 😊

Example 5 - Printing String Constants on the Output Screen

  • Task 5
Completely and Correctly Understand the Task
  • Task Description
    • Write a Program in Python which prints the following String in the Text given in Required Output as a String Constant on the Output Screen.
      • +
      • =
      • –
    • Required Output
      • 5 + 5 = 10 and 5 – 5 = 0
Plan and Design Solution to the Task
  • Input-Processing-Output
    • Input
      • Data
        • A String Constant (Comprising of a Single Character)
      • Instruction(s)
        • Display Text Message along with a String Constant on the Output Screen
    • Output
      • Text Message along with a String Constant is displayed on the Output Screen
    • Processing
      • Use print() Function
Implementation in Python
				
					'''
__author__   = Ms. Samavi Salman
__copyright__= Copyright (C) 2020 Ms. Samavi Salman
__license__  = Public Domain
__version__  = 1.0
'''

# Input + Processing + Output

print(5, "+", 5, "=", 10, "and", 5, "-", 5, "=", 0)
				
			
				
					5 + 5 = 10 and 5 - 5 = 0
				
			
Analysis, Main Findings and Conclusions
  • Analysis of Python Program
    • In this Python Program, I displayed a Text Message along with a String Constant (comprising of Single Characters i.e., +, – and =) on the Output Screen using
      • print() Function
  • Main Findings
    • Alhamdulillah (الحمدللہ) 😊, print() Function efficiently and effectively performed my required Task i.e.,
      • Displayed a Text Message along with a String Constant (comprising of Single Characters i.e., +, – and =) on the Output Screen
  • Conclusions
    • To conclude, our main goal i.e.,
      • Displaying a Text Message along with a String Constant (comprising of Single Characters i.e., +, – and =) on Output Screen was successfully accomplished using print() Function. Alhamdulillah (الحمدللہ) 😊
  • Difference Between Normal Text in print() Function and Integer Constant
Code Fragments
  • Consider the following two Code Fragments
    • Code 1
      • print(“My grade in Python Programming is: A”)
    • Output of Code 1
      • My grade in Python Programming is: A
    • Code 2
      • print(“My grade in Python Programming is:”, + “A”)
    • Output of Code 2
      • My grade in Python Programming is: A
Analysis and Conclusions
  • Analysis of Python Program
    • Output of Code 1 is exactly same as Output of Code 2
      • However, in Code 1
        • A is a String
      • Whereas, in Code 2
        • A is a String Constant
Conclusions
  • Normal Text and String Constants in print() Function are treated differently

Example 6 - Printing String Constants on the Output Screen

  • Task 6
Completely and Correctly Understand the Task
  • Task Description
    • Write a Program in Python which prints the following String in the Text given in Required Output as a String Constant on the Output Screen.
      • Anjeer
    • Required Output
      • One of the fruits of Jannah is: Anjeer
Plan and Design Solution to the Task
  • Input-Processing-Output
    • Input
      • Data
        • A String Constant (Comprising of Multiple Characters)
      • Instruction(s)
        • Display Text Message along with a String Constant on the Output Screen
    • Output
      • Text Message along with a String Constant is displayed on the Output Screen
    • Processing
      • Use print() Function
  •  
Implementation in Python
				
					'''
__author__   = Ms. Samavi Salman
__copyright__= Copyright (C) 2020 Ms. Samavi Salman
__license__  = Public Domain
__version__  = 1.0
'''

# Input + Processing + Output

print("One of the fruits of Jannah is:" + "Anjeer")
				
			
				
					One of the fruits of Jannah is: Anjeer
				
			
Analysis, Main Findings and Conclusions
  • Analysis of Python Program
    • In this Python Program, I displayed a Text Message along with a String Constant (comprising of Multiple Characters i.e., Anjeer) on the Output Screen using
      •  print() Function
  • Main Findings
    • Alhamdulillah (الحمدللہ) 😊, print() Function efficiently and effectively performed my required Task i.e.,
      • Displayed a Text Message along with a String Constant (comprising of Multiple Characters i.e., Anjeer) on the Output Screen
  • Conclusions
    • To conclude, our main goal i.e.,
      • Displaying a Text Message along with a String Constant (comprising of Multiple Characters i.e., Anjeer) on Output Screen was successfully accomplished using print() Function. Alhamdulillah (الحمدللہ) 😊

Example 7 - Printing String Constants on the Output Screen

  • Task 7
Completely and Correctly Understand the Task
  • Task Description
    • Write a Program in Python which prints the following String in the Text given in Required Output as a String Constant on the Output Screen.
      • Hazrat Asiya R.A.
    • Required Output
      • First woman to enter Jannah is: Hazrat Asiya R.A.
Plan and Design Solution to the Task
  • Input-Processing-Output
    • Input
      • Data
        • A String Constant (Comprising of Multiple Characters)
      • Instruction(s)
        • Display Text Message along with a String Constant on the Output Screen
    • Output
      • Text Message along with a String Constant is displayed on the Output Screen
    • Processing
      • Use print() Function
  •  
Implementation in Python
				
					'''
__author__   = Ms. Samavi Salman
__copyright__= Copyright (C) 2020 Ms. Samavi Salman
__license__  = Public Domain
__version__  = 1.0
'''

# Input + Processing + Output

print("First woman to enter Jannah is:" + "Hazrat Asiya R.A.")
				
			
				
					First woman to enter Jannah is: Hazrat Asiya R.A.
				
			
Analysis, Main Findings and Conclusions
  • Analysis of Python Program
    • In this Python Program, I displayed a Text Message along with a String Constant (comprising of Multiple Characters i.e., Hazrat Asiya R.A.) on the Output Screen using
      •  print() Function
  • Main Findings
    • Alhamdulillah (الحمدللہ) 😊, print() Function efficiently and effectively performed my required Task i.e.,
      • Displayed a Text Message along with a String Constant (comprising of Multiple Characters i.e., Hazrat Asiya R.A.) on the Output Screen
  • Conclusions
    • To conclude, our main goal i.e.,
      • Displaying a Text Message along with a String Constant (comprising of Multiple Characters i.e., Hazrat Asiya R.A.) on Output Screen was successfully accomplished using print() Function. Alhamdulillah (الحمدللہ) 😊

Example 8 - Printing String Constants on the Output Screen

  • Task 8
Completely and Correctly Understand the Task
  • Task Description
    • Write a Program in Python which prints the following String in the Text given in Required Output as a String Constant on the Output Screen.
      • Hazrat Maryam (R.A)
    • Required Output
      • Name of woman mentioned in the Holy Quran is: Hazrat Maryam (R.A)
Plan and Design Solution to the Task
  • Input-Processing-Output
    • Input
      • Data
        • A String Constant (Comprising of Multiple Characters)
      • Instruction(s)
        • Display Text Message along with a String Constant on the Output Screen
    • Output
      • Text Message along with a String Constant is displayed on the Output Screen
    • Processing
      • Use print() Function
  •  
Implementation in Python
				
					'''
__author__   = Ms. Samavi Salman
__copyright__= Copyright (C) 2020 Ms. Samavi Salman
__license__  = Public Domain
__version__  = 1.0
'''

# Input + Processing + Output

print("Name of woman mentioned in the Holy Quran is: " + "Hazrat Maryam (R.A)")
				
			
				
					Name of woman mentioned in the Holy Quran is: Hazrat Maryam (R.A)
				
			
Analysis, Main Findings and Conclusions
  • Analysis of Python Program
    • In this Python Program, I displayed a Text Message along with a String Constant (comprising of Multiple Characters i.e., Hazrat Maryam (R.A)) on the Output Screen using
      •  print() Function
  • Main Findings
    • Alhamdulillah (الحمدللہ) 😊, print() Function efficiently and effectively performed my required Task i.e.,
      • Displayed a Text Message along with a String Constant (comprising of Multiple Characters i.e., Hazrat Maryam (R.A))on the Output Screen
  • Conclusions
    • To conclude, our main goal i.e.,
      • Displaying a Text Message along with a String Constant (comprising of Multiple Characters i.e., Hazrat Maryam (R.A)) on Output Screen was successfully accomplished using print() Function. Alhamdulillah (الحمدللہ) 😊

Example 9 - Printing String Constants on the Output Screen

  • Task 9
Completely and Correctly Understand the Task
  • Task Description
    • Write a Program in Python which prints the following String in the Text given in Required Output as a String Constant on the Output Screen.
      • Hazrat Abu Bakar Siddique (R.A.)
      • Hazrat Amma Khadija (R.A.)
    • Required Output
      • Hazrat Abu Bakar Siddique (R.A.) was the first Male Sahabi to accept Islam and Hazrat Amma Khadija (R.A.) was the first Female Sahabi to accept Islam
Plan and Design Solution to the Task
  • Input-Processing-Output
    • Input
      • Data
        • A String Constant (Comprising of Multiple Characters)
          • String Constant 1 (i.e., Hazrat Abu Bakar Siddique (R.A.))
          • String Constant 2 (i.e., Hazrat Amma Khadija (R.A.))
      • Instruction(s)
        • Display Text Message along with a String Constant on the Output Screen
    • Output
      • Text Message along with a String Constant is displayed on the Output Screen
    • Processing
      • Use print() Function
Implementation in Python
				
					'''
__author__   = Ms. Samavi Salman
__copyright__= Copyright (C) 2020 Ms. Samavi Salman
__license__  = Public Domain
__version__  = 1.0
'''

# Input + Processing + Output

print("Hazrat Abu Bakar Siddique (R.A.)" + " was the first Male Sahabi to accept Islam and" + " Hazrat Amma Khadija (R.A.)" + " was the first Female Sahabi to accept Islam")
				
			
				
					Hazrat Abu Bakar Siddique (R.A.) was the first Male Sahabi to accept Islam and Hazrat Amma Khadija (R.A.) was the first Female Sahabi to accept Islam
				
			
Analysis, Main Findings and Conclusions
  • Analysis of Python Program
    • In this Python Program, I displayed a Text Message along with String Constants (comprising of Multiple Characters i.e., Hazrat Abu Bakar Siddique (R.A.) and Hazrat Amma Khadija (R.A.)) on the Output Screen using
      • print() Function
  • Main Findings
    • Alhamdulillah (الحمدللہ) 😊, print() Function efficiently and effectively performed my required Task i.e.,
      • Displayed a Text Message along with String Constants (comprising of Multiple Characters i.e., Hazrat Abu Bakar Siddique (R.A.) and Hazrat Amma Khadija (R.A.)) on the Output Screen
  • Conclusions
    • To conclude, our main goal i.e.,
      • isplaying a Text Message along with String Constants (comprising of Multiple Characters i.e., Hazrat Abu Bakar Siddique (R.A.) and Hazrat Amma Khadija (R.A.)) on Output Screen was successfully accomplished using print() Function. Alhamdulillah (الحمدللہ) 😊

Example 10 - Printing String Constants on the Output Screen

  • Task 10
Completely and Correctly Understand the Task
  • Task Description
    • Write a Program in Python which prints the following String in the Text given in Required Output as a String Constant on the Output Screen.
      • Introduction to Python
      • A
    • Required Output
      • Course Title: Introduction to Python
      • Grade: A
Plan and Design Solution to the Task
  • Input-Processing-Output
    • Input
      • Data
        • String Constant 1 (i.e., Introduction to Python)
        • String Constant 2 (i.e., A)
      • Instruction(s)
        • Display Text Message along with a String Constant on the Output Screen
    • Output
      • Text Message along with a String Constant is displayed on the Output Screen
    • Processing
      • Use print() Function
  •  
Implementation in Python
				
					'''
__author__   = Ms. Samavi Salman
__copyright__= Copyright (C) 2020 Ms. Samavi Salman
__license__  = Public Domain
__version__  = 1.0
'''

# Input + Processing + Output

print("Course Title:  " + "Introduction to Python")
print("Grade: " + "A ")
				
			
				
					Course Title: Introduction to Python 
Grade: A
				
			
Analysis, Main Findings and Conclusions
  • Analysis of Python Program
    • In this Python Program, I displayed a Text Message along with a String Constant (comprising of Multiple Characters i.e., Introduction to Python and A) on the Output Screen using
      •  print() Function
  • Main Findings
    • Alhamdulillah (الحمدللہ) 😊, print() Function efficiently and effectively performed my required Task i.e.,
      • Displayed a Text Message along with a String Constant (comprising of Multiple Characters i.e., Introduction to Python and A) on the Output Screen
  • Conclusions
    • To conclude, our main goal i.e.,
      • Displaying a Text Message along with a String Constant (comprising of Multiple Characters i.e., Introduction to Python and A) on Output Screen was successfully accomplished using print() Function. Alhamdulillah (الحمدللہ) 😊
  • Difference Between Normal Text in print() Function and Integer Constant
Code Fragments
  • Consider the following two Code Fragments
    • Code 1
      • print(“Allah loves those who love the humanity”)
    • Output of Code 1
      • Allah loves those who love the humanity
    • Code 2
      • print(“Allah” + “loves those who love the humanity”)
    • Output of Code 2
      • Allah loves those who love the humanity
  •  
Analysis and Conclusions
  • Analysis of Python Program
    • Output of Code 1 is exactly same as Output of Code 2
      • However, in Code 1
        • Allah is a String
      • Whereas, in Code 2
        • Allah is String Constant
Conclusions
  • Normal Text and String Constants in print() Function are treated differently

TODO and Your Turn

Todo Tasks
Your Turn Tasks
Todo Tasks

TODO Task 1

  • Task
    • Consider the following Tasks and answer the questions given below
  • Note
    • Your answer should be
      • Well Justified
  • Questions
    • Write Python Programs for all the Tasks given above by following the Template given in this Chapter i.e.,
      • Completely and Correctly Understand the Task
        • Task Description
        • Required Output
      • Plan and Design Solution of the Task
        • Input-Processing-Output
          • Input
            • Data
            • Instructions
          • Output
          • Processing
      • Implementation in Python
        • Code
        • Output of Code
      • Analysis, Main Findings and Conclusions
        • Analysis of Python Program
        • Main Findings
        • Conclusion

 

                                                                        Task 1

Completely and Correctly Understand the Task

Task Description

  • Write a Program in Python which prints the following String in the Text given in Required Output as a String Constant on the Output Screen.
    •  *

Required Output

* symbol represents Multiplication

  

                                                                        Task 2

Completely and Correctly Understand the Task

Task Description

  • Write a Program in Python which prints the following String in the Text given in Required Output as String Constants on the Output Screen.
    • ^
    • =

Required Output

2 ^ 3 = 8

  

                                                                        Task 3

Completely and Correctly Understand the Task

Task Description

  • Write a Program in Python which prints the following String in the Text given in Required Output as String Constants on the Output Screen.
    • /
    • =
    • *
    • =

Required Output

5 / 5 = 1 and 5 * 5 = 25

                                                                        Task 4

Completely and Correctly Understand the Task

Task Description

  • Write a Program in Python which prints the following String in the Text given in Required Output as a String Constant on the Output Screen.
    • Masjid-e-Quba

Required Output

The First Mosque built in Madina was: Masjid-e-Quba

  

                                                                        Task 5

Completely and Correctly Understand the Task

Task Description

  • Write a Program in Python which prints the following String in the Text given in Required Output as a String Constant on the Output Screen.
    • Hazrat Sarah A.S.

Required Output

First wife of Hazrat Ibrahim A.S. was: Hazrat Sarah A.S.

  

                                                                        Task 6

Completely and Correctly Understand the Task

Task Description

  • Write a Program in Python which prints the following String in the Text given in Required Output as String Constants on the Output Screen.
    • Hazrat Ibrahim (A.S)
    • Hazrat Ismail (A.S)

Required Output

Khana Kabba was first constructed by: Hazrat Ibrahim (A.S) and Hazrat Ismail (A.S)

  

                                                                        Task 7

Completely and Correctly Understand the Task

Task Description

  • Write a Program in Python which prints the following String in the Text given in Required Output as a String Constant on the Output Screen.
    • Hazrat Hajira A.S.

Required Output

Second wife of Hazrat Ibrahim (A.S.) was: Hazrat Hajira A.S.

  

                                                                        Task 8

Completely and Correctly Understand the Task

Task Description

  • Write a Program in Python which prints the following String in the Text given in Required Output as String Constants on the Output Screen.
    • Hazrat Ismail (A.S.)
    • Hazrat Ishaq (A.S.)

Required Output

Hazrat Ismail (A.S.) and Hazrat Ishaq (A.S.) were children of Hazrat Ibrahim (A.S.)

Your Turn Tasks

Your Turn Task 1

  • Task
    • Write at least 10 different Tasks which are very similar to the ones given in the TODO Tasks
    • For each Task write a Python Program using the following Template mentioned in this Chapter i.e.,
  • Note
    • Your answer should be
      • Well Justified
  • Questions
    • Write Python Programs for all the Tasks given above by following the Template given in this Chapter i.e.,
      • Completely and Correctly Understand the Task
        • Task Description
        • Required Output
      • Plan and Design Solution of the Task
        • Input-Processing-Output
          • Input
            • Data
            • Instructions
          • Output
          • Processing
      • Implementation in Python
        • Code
        • Output of Code
      • Analysis, Main Findings and Conclusions
        • Analysis of Python Program
        • Main Findings
        • Conclusion

Combination of Integer, Float and String Constants

Example 1 - Combination of Integer, Float and String Constants

  • Task 1
Completely and Correctly Understand the Task
  • Task Description
    • Write a Python Program which prints the following Integer, Float and String Values in the Text given in Required Output as Integer, Float and String Constants on the Output Screen.
      • Allah                                          (as String)
      • 2699                                          (as Integer)
      • Muhammad (S.A.W.W.)        (as String)
      • 114.0                                          (as Float)
  • Required Output
    • Allah is written 2699 times in the Holy Quran and Muhammad (S.A.W.W.) is written 4 times. There are 114.0 Surah in the Holy Quran.
Plan and Design Solution to the Task
  • Input-Processing-Output
    • Input
      • Data
        • An Integer Constant
        • A Float Constant
        • Two String Constants
      • Instruction(s)
        • Display Text Message along with Integer, Float and String Constants on the Output Screen
    • Output
      • Text Message along with an Integer, Float and String Constants is displayed on the Output Screen
    • Processing
      • Use print() Function
Implementation in Python
				
					'''
__author__   = Ms. Samavi Salman
__copyright__= Copyright (C) 2020 Ms. Samavi Salman
__license__  = Public Domain
__version__  = 1.0
'''

# Input + Processing + Output

print("Allah" + "is written", 2699, "times in the Holy Quran and "+ "Muhammad (S.A.W.W)" + " is written", 4, "times. There are", 114.0, "Surah in the Holy Quran.") 
				
			
				
					Allah is written 2699 times in the Holy Quran and Muhammad (S.A.W.W.) is written 4 times. There are 114.0 Surah in the Holy Quran.
				
			
Analysis, Main Findings and Conclusions
  • Analysis of Python Program
    • In this Python Program, I displayed a Text Message along with Integer, Float and String Constants on the Output Screen using
      •  print() Function
  • Main Findings
    • Alhamdulillah (الحمدللہ) 😊, print() Function efficiently and effectively performed my required Task i.e.,
      • Displayed a Text Message along with Integer, Float and String Constants on the Output Screen
  • Conclusions
    • To conclude, our main goal i.e.,
      • Displaying a Text Message along with Integer, Float and String Constants on Output Screen was successfully accomplished using print() Function. Alhamdulillah (الحمدللہ) 😊

Example 2 - Combination of Integer, Float and String Constants

  • Task 2
Completely and Correctly Understand the Task
  • Task Description
    • Write a Python Program which prints the following Integer, Float and String Values in the Text given in Required Output as Integer, Float and String Constants on the Output Screen.
      • 40                                                        (as Integer)
      • 1.0                                                        (as Float)
      • Hazrat Muhammad (S.A.W.W.)     (as String)
      • First Revelation                                (as String)
    • Required Output
      • First revelation (Wahi) was revealed on Hazrat Muhammad (S.A.W.W.) at the age of 40. He (S.A.W.W.) performed 1.0 Umarah.
Plan and Design Solution to the Task
  • Input-Processing-Output
    • Input
      • Data
        • An Integer Constant
        • A Float Constant
        • Two String Constants
      • Instruction(s)
        • Display Text Message along with Integer, Float and String Constants on the Output Screen
    • Output
      • Text Message along with an Integer, Float and String Constants is displayed on the Output Screen
    • Processing
      • Use print() Function
Implementation in Python
				
					'''
__author__   = Ms. Samavi Salman
__copyright__= Copyright (C) 2020 Ms. Samavi Salman
__license__  = Public Domain
__version__  = 1.0
'''

# Input + Processing + Output

print("Allah" + "is written", 2699, "times in the Holy Quran and "+ "Muhammad (S.A.W.W)" + " is written", 4, "times. There are", 114.0, "Surah in the Holy Quran.") 
				
			
				
					Allah is written 2699 times in the Holy Quran and Muhammad (S.A.W.W.) is written 4 times. There are 114.0 Surah in the Holy Quran.
				
			
Analysis, Main Findings and Conclusions
  • Analysis of Python Program
    • In this Python Program, I displayed a Text Message along with Integer, Float and String Constants on the Output Screen using
      •  print() Function
  • Main Findings
    • Alhamdulillah (الحمدللہ) 😊, print() Function efficiently and effectively performed my required Task i.e.,
      • Displayed a Text Message along with Integer, Float and String Constants on the Output Screen
  • Conclusions
    • To conclude, our main goal i.e.,
      • Displaying a Text Message along with Integer, Float and String Constants on Output Screen was successfully accomplished using print() Function. Alhamdulillah (الحمدللہ) 😊

Example 3 - Combination of Integer, Float and String Constants

  • Task 3
Completely and Correctly Understand the Task
  • Task Description
    • Write a Python Program which prints the following Integer, Float and String Values in the Text given in Required Output as Integer, Float and String Constants on the Output Screen.
      • 8             (as Integer)
      • 1.0          (as Float)
      • 7              (as Integer)
      • Heaven (as String)
      • Skies      (as String)
    • Required Output
      • There are 8 doors of Heaven in Quran. There are 7.0 levels of Heaven in Quran.  There are 7 skies.
Plan and Design Solution to the Task
  • Input-Processing-Output
    • Input
      • Data
        • Two Integer Constant
        • A Float Constant
        • Two String Constants
      • Instruction(s)
        • Display Text Message along with Integer, Float and String Constants on the Output Screen
    • Output
      • Text Message along with an Integer, Float and String Constants is displayed on the Output Screen
    • Processing
      • Use print() Function
Implementation in Python
				
					'''
__author__   = Ms. Samavi Salman
__copyright__= Copyright (C) 2020 Ms. Samavi Salman
__license__  = Public Domain
__version__  = 1.0
'''

# Input + Processing + Output

print("There are", 8, "doors" + " of Heaven" + "in Quran. There are ", 7.0, "levels of Heaven in Quran. There are", 7,"skies.")
				
			
				
					There are 8 doors of Heaven in Quran. There are 7.0 levels of Heaven in Quran.  There are 7 skies.
				
			
Analysis, Main Findings and Conclusions
  • Analysis of Python Program
    • In this Python Program, I displayed a Text Message along with Integer, Float and String Constants on the Output Screen using
      •  print() Function
  • Main Findings
    • Alhamdulillah (الحمدللہ) 😊, print() Function efficiently and effectively performed my required Task i.e.,
      • Displayed a Text Message along with Integer, Float and String Constants on the Output Screen
  • Conclusions
    • To conclude, our main goal i.e.,
      • Displaying a Text Message along with Integer, Float and String Constants on Output Screen was successfully accomplished using print() Function. Alhamdulillah (الحمدللہ) 😊

TODO and Your Turn

Todo Tasks
Your Turn Tasks
Todo Tasks

TODO Task 1

  • Task
    • Consider the following Tasks and answer the questions given below
  • Note
    • Your answer should be
      • Well Justified
  • Questions
    • Write Python Programs for all the Tasks given above by following the Template given in this Chapter i.e.,
      • Completely and Correctly Understand the Task
        • Task Description
        • Required Output
      • Plan and Design Solution of the Task
        • Input-Processing-Output
          • Input
            • Data
            • Instructions
          • Output
          • Processing
      • Implementation in Python
        • Code
        • Output of Code
      • Analysis, Main Findings and Conclusions
        • Analysis of Python Program
        • Main Findings
        • Conclusion

 

                                                                        Task 1

Completely and Correctly Understand the Task

Task Description

  • Write a Python Program which prints the following Integer, Float and String Values in the Text given in Required Output as Integer, Float and String Constants on the Output Screen.
    • 13                                 (as Integer)
    • 3.0                                (as Float)
    • 4.0                                (as Float)
    • Hazrat Muhammad  (as String)

Required Output

Hazrat Muhammad (S.A.W.W.) have 13 wives. He has 3.0 sons and 4.0 daughters

 

                                                                        Task 2

Completely and Correctly Understand the Task

Task Description

  • Write a Python Program which prints the following Integer, Float and String Values in the Text given in Required Output as Integer, Float and String Constants on the Output Screen.
    • 114               (as Integer)
    • 25.0              (as Float)
    • 89.0              (as Float)
    • Makki           (as String)
    • Madni           (as String)

Required Output

There are total 114 Surah in Quran. Out of which 89.0 Surah’s are Makki and 25.0 Surah’s are Madni

  

                                                                        Task 3

Completely and Correctly Understand the Task

Task Description

  • Write a Python Program which prints the following Integer, Float and String Values in the Text given in Required Output as Integer, Float and String Constants on the Output Screen.
    • 4.0               (as Float)
    • Tawrat        (as Integer + String)
    • Zabur          (as Integer + String)
    • Injil              (as Integer + String)
    • Quran          (as Integer + String)

Required Output

Allah has sent 4.0 Holy Books. The order of the books are as follows:

1)  Tawrat

2)  Zabur

3)  Injil

4)  Quran Majeed

Your Turn Tasks

Your Turn Task 1

  • Task
    • Write at least 10 different Tasks which are very similar to the ones given in the TODO Tasks
    • For each Task write a Python Program using the following Template mentioned in this Chapter i.e.,
  • Note
    • Your answer should be
      • Well Justified
  • Questions
    • Write Python Programs for all the Tasks given above by following the Template given in this Chapter i.e.,
      • Completely and Correctly Understand the Task
        • Task Description
        • Required Output
      • Plan and Design Solution of the Task
        • Input-Processing-Output
          • Input
            • Data
            • Instructions
          • Output
          • Processing
      • Implementation in Python
        • Code
        • Output of Code
      • Analysis, Main Findings and Conclusions
        • Analysis of Python Program
        • Main Findings
        • Conclusion

Chapter Summary

  • Chapter Summary

In this Chapter, I presented the following main concepts:

  • Constants
    • Constants are defined as those (Data) Values that do not change (i.e., remain the same) every time a Python Program is executed
  • The two main types of Numeric Constants are
    • Integer Constants
    • Float Constants
  • Integer Constants
    • Integer Constants are defined as those (Integer) Values that do not change (i.e., remain the same) every time a Python Program is executed
  • Float Constants
    • Float Constants are defined as those (Float) Values that do not change (i.e., remain the same) every time a Python Program is executed
  • String
    • A String is defined as a Sequence of Characters
  • String Constants
    • String Constants are defined as those Fixed Sequence of Characters that do not change (i.e., remain the same) every time a Python Program is executed
  • The two main types of String Constants are
    • String Constant Comprising of a Single Character
    • String Constant Comprising of Multiple Characters

In Next Chapter

  • In Next Chapter
  • In Sha Allah, in the next Chapter, I will present a detailed discussion on
  • Variables in Python
Chapter 4 - Basics of Python​
  • Previous
Chapter 6 - Variables in Python
  • Next
Share this article!
Facebook
Twitter
LinkedIn
About Us

Ilm O Irfan Technologies believes that honest dedicated hard work with the ethical approach of commitment true to every word, and trust-building is the road to success in any field of business or life.

Quick Links
  • About Us
  • Contact
Useful Links
  • Privacy Policy
  • Terms and Conditions
  • Disclaimer
  • Support
  • FAQ
Subscribe Our Newsletter
Facebook Twitter Linkedin Instagram Youtube

© 2022 Ilmo Irfan. All Rights Reserved.