Quick actions

cmd+k|ctrl+k

Navigation

Languages

Data Types

Snippet info

Language

Python

Visibility

public

Author

akaimal04

Created

2024-12-22T17:20:45.207736Z

Updated

2024-12-24T21:36:18.493129Z

# fundamental data types

    # int and float
print("* ints and floats")
print(type(1 + 1))
print(type(7 // 3))
    
print(type(1.1 ** 2))

    # complex and bin
print("\n* bin")
complex
print(bin(5))
print(int("0b101", 2))

    #booleans
print("\n* booleans")
is_cool = True
print(is_cool)


    # strings
print("\n* strings")
print(type(str(106)))
print(len("01234"))
quote = "I am inevitable"
print(quote.upper())
print(quote)

    # escape sequences
print("\n* escape sequences")
print("hello \"there\" ")


list
tuple
set
dict

# classes -> custom types

# specialized data types

None

# math functions
print("\n* math functions")
print(round(7.3))
print(abs(-34))

# operator precedence
# just like PEMDAS
print(13 - 1 * 2 ** 3)

# formatted strings
print("\n* formatted strings")
name = "Arjun"
age = 20
print(f"hello {name}, you're {age} years old, right?")

# string indexes
print("\n* string indexes")
text = "0123456789"
print(text[0])
print(text[-1])
print(text[7:10])
print(text[:13:2])
print(text[::-1])
INFO