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: August 4, 2022
    • Answers: 0

    Endantadine Norway, Endantadine order online

    • On: August 7, 2022
    • Answers: 0

    Buy Generic Latisse Italy, Latisse and eyesight

    • On: September 21, 2021
    • Answer: 1

    What killed my process and why in Linux?

    • On: August 5, 2022
    • Answers: 0

    Loxitane Sweden, Loxitane strength

    • On: February 10, 2023
    • Answers: 0

    Check MySQL version

  • strapcart_online
    strapcart_online added an answer Sildenafil citrate is a common ingredient in Cenforce 150mg tablets. This drug… March 21, 2023 at 11:42 am
  • strapcart_online
    strapcart_online added an answer Vilitra 20mg tablets are used to overcome the problem of… March 18, 2023 at 6:13 am
  • ashok
    ashok added an answer Not every girl, there are some girls out there who… March 16, 2023 at 4:15 am
  • strapcart_online
    strapcart_online added an answer Tadarise 40 Tablet is used to permanently remove the problem… March 4, 2023 at 5:48 am
  • strapcart_online
    strapcart_online added an answer Men use Cenforce D tablets for the treatment of sexual… March 1, 2023 at 5:59 am

Adv 120x600

Trending Categories

Health
2042Questions
, 4Followers
Programming
1236Questions
, 0Followers
Technology
216Questions
, 3Followers
General Knowledge
131Questions
, 0Followers
Business & Finance
84Questions
, 4Followers

Adv 120×600

Stats

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

Users

niyadas823

niyadas823

  • 0 Questions
  • 0 Answers
nirala3

nirala3

  • 2 Questions
  • 0 Answers
Perrywalton

Perrywalton

  • 1 Question
  • 0 Answers
veeraa

veeraa

  • 0 Questions
  • 0 Answers
Stewesmitz

Stewesmitz

  • 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.