Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

Stackorigin – The Community of Question and Answers

Stackorigin – The Community of Question and Answers Logo Stackorigin – The Community of Question and Answers Logo
Search
Ask A Question

Mobile menu

Close
Ask a Question

Data Type

In programming, data type is an important concept. Variables can store data of different types like str, int, float….

Look at Table for Python Data type’s:

IntStrFloat
BytesTupleSet
RangeNoneComplex
ListDictBytearray
Frozen SetBool

Note: In python3 Long Data Type not there.

Int Data Type:

Binary Form: If we keep 0b or oB before number it will treat as Binary Number.

a = ob1111, b = 1111(not binary)
  • Octa Form: If we keep 0O(zero, O) before number it will treat as Octa Number.

a = 0O7777, b = 7777(not octa)

  • Hexa Form: If we keep 0x(zero, small x or cap’s X) before number it will treat as Hexa Number.

a = 0xFace, b = Face(not Hexa)

Float Data Type:

Python’s built-in float type has double precision (it’s a C double in CPython, a Java double in Jython). If you need more precision, get NumPy and use its numpy.

x = 1.200

Complex Data Type:

Complex data type formula is: a + bj

Where: a = Real Part, b = Imaginary Part

In Real Part, we can use any type of number’s like

Bin, Decimal, Octa, Hexa

Example: a = 10 +ob111

a.real => Get Real Value = 10.0

a.imag = > Get Imaginary Value = 20j

But Imaginary Part, it will accept only Decimal and Float Number’s only

Example: a = ob111 + 20j (Correct) b = 10j + 0b111 (Wrong)

Bool Data Type:

Bool Data type will consider as either True or False.

True + True = True

True + False = False

False + False = False

String Data Type:

In python we can define string in Quote’s. either its single or Thrible Quote’s

a = “Welcome to Stackorigin”

b = “””Stackorigin introduced Python tutorial”””

String Forward Direction: [begin:end-1:step]

Step: slice step cant be zero

String Backward Direction:[begin:end+1:step]

Step: slice step cant be zero

Concatenation Operator: Both should be string only.

example: “stack” + “origin” = stackorigin

Repetition Operator: One type should be int and another one is string.

example: “stack” * 5 => stackstackstackstackstack

len() to know how many character’s are there in string.

Strip(): remove space between string.

Count() count sub string in the give string.

Replace() replace a string from old to new string.

Split():split is applicable for string object.  split() method splits a string into a list.

RSplit(): Rsplit method is used to reverse the split.

Join() join() method takes all items in an iterable and joins them into one string.

Upper(): upper() method converts all lowercase characters in a string into uppercase characters and returns it

Lower(): lower() method converts all uppercase characters in a string into lowercase characters and returns it

SwapCase() Make the lower case letters upper case and the upper case letters lower case

Title(): Make the first letter in each word upper case

Capitalize(): Upper case the first letter in this sentence

Startswith() Check if the string starts with “stackorigin”

Endswith() Check if the string end’s with “python”

find():The find() method finds the first occurrence of the specified value. if not found it will return “-1”.

RFind() The rfind() method finds the last occurrence of the specified value.

Index(): The index() method returns the position at the first occurrence of the specified value.

RIndex(): The rindex() method finds the last occurrence of the specified value.

isalpha() The isalpha() method returns True if all the characters are alphabet letters (a-z).

isalnum()  isalnum() method returns True if all the characters are alphanumeric, meaning alphabet letter (a-z) and numbers (0-9)

isdigit():The isdigit() method returns True if all the characters are digits, otherwise False.

islower():The islower() method returns True if all the characters are in lower case, otherwise False.

isupper(): The isupper() method returns True if all the characters are in upper case, otherwise False.

istitle(): The istitle() method returns True if all words in a text start with a upper case letter, AND the rest of the word are lower case letters, otherwise False.

isspace(): The isspace() method returns True if all the characters in a string are whitespaces, otherwise False.

Share
  • Facebook

Sidebar

Ask A Question

Adv 120x600

Looking for advertising?

Consider These Things If You Appreciate What stackorigin Does: Stackorigin is a community where you can ask questions and find answers, for free to everyone. We would appreciate it if you bought us a coffee if you liked what we were doing.

Buy me a Coffe

Adv 120x600

  • Random
  • Answers
    • On: July 28, 2022
    • Answers: 2

    How do I include image files in Django templates?

    • On: August 5, 2022
    • Answers: 0

    cheapest price!, Vasotec and digoxin

    • On: July 27, 2020
    • Answer: 1

    What are the best online shopping sites in India?

    • On: August 9, 2022
    • Answers: 0

    How to deactivate your LinkedIn account

    • On: August 6, 2022
    • Answers: 0

    Where to buy Careprost alternative in USA, Careprost sale usa

  • sam
    sam added an answer Please go launch below link   https://digitalcloud.training/aws-sysops-administrator-associate-free-practice-exam-questions/ August 3, 2023 at 9:55 am
  • newoc
    newoc added an answer Absolutely! You can confidently utilize authentic and up-to-date Dumps that… July 22, 2023 at 7:31 am
  • strapcart_online
    strapcart_online added an answer Impotence is commonly seen in men between the ages of… July 21, 2023 at 8:26 am
  • lasop
    lasop added an answer If you're looking for the ultimate resource to excel in… July 19, 2023 at 5:00 am
  • bruceparker
    bruceparker added an answer Buy Dapoxetine Online is a medication primarily used for the… July 17, 2023 at 7:34 am

Adv 120x600

Trending Categories

Health
2050Questions
, 4Followers
Programming
1296Questions
, 0Followers
Technology
218Questions
, 3Followers
General Knowledge
131Questions
, 0Followers
Business & Finance
86Questions
, 4Followers

Adv 120×600

Stats

  • Questions 4k
  • Answers 1k
  • Best Answers 105
  • Users 163

Users

Aluminium Die Casting Products Manufacturers

Aluminium Die Casting Products Manufacturers

  • 0 Questions
  • 0 Answers
irene1707

irene1707

  • 0 Questions
  • 0 Answers
Ductile Iron Casting Manufacturers

Ductile Iron Casting Manufacturers

  • 0 Questions
  • 0 Answers
Navratan

Navratan

  • 0 Questions
  • 0 Answers
AAC Blocks Manufacturers in Tamil Nadu

AAC Blocks Manufacturers in Tamil Nadu

  • 0 Questions
  • 0 Answers

Adv 120×600

Explore

  • Recent Questions
  • Most Answered
  • Answers
  • No Answers
  • Most Visited
  • Most Voted
  • Random
  • Polls

Footer

Stackorigin - The Community of Question and Answers

Stackorigin

Stackorigin is the world’s largest Q&A networking site, Stackorigin community brings you the collaboration of all the various Questions and the related Answers given by the community.

About

  • About Us
  • Contact Us
  • FAQ
  • Submit Guest Post Article on Technology, Education, Health, Apps, Gadgets, IoT, AI, Business, Digital Marketing and More

Info

  • Privacy Policy
  • Terms and Conditions
  • Community Guidelines
  • Tags

Products

  • Tutorials
  • Advertising
  • Categories
  • Corona
  • StackHow

Follow

© 2022 Stackorigin. All Rights Reserved.