Close Menu
    Trending
    • Why Knowing Your Customer Drives Smarter Growth (and Higher Profits)
    • Stop Building AI Platforms | Towards Data Science
    • What If Your Portfolio Could Speak for You? | by Lusha Wang | Jun, 2025
    • High Paying, Six Figure Jobs For Recent Graduates: Report
    • What If I had AI in 2018: Rent the Runway Fulfillment Center Optimization
    • YouBot: Understanding YouTube Comments and Chatting Intelligently — An Engineer’s Perspective | by Sercan Teyhani | Jun, 2025
    • Inspiring Quotes From Brian Wilson of The Beach Boys
    • AI Is Not a Black Box (Relatively Speaking)
    Finance StarGate
    • Home
    • Artificial Intelligence
    • AI Technology
    • Data Science
    • Machine Learning
    • Finance
    • Passive Income
    Finance StarGate
    Home»Machine Learning»Introduction to Python. Code is a set of instructions to do… | by 桜満 集 | Feb, 2025
    Machine Learning

    Introduction to Python. Code is a set of instructions to do… | by 桜満 集 | Feb, 2025

    FinanceStarGateBy FinanceStarGateFebruary 17, 2025No Comments2 Mins Read
    Share Facebook Twitter Pinterest LinkedIn Tumblr Reddit Telegram Email
    Share
    Facebook Twitter LinkedIn Pinterest Email


    Code is a set of directions to do one thing particular, given to a pc.

    Variables are labels to containers of saved data

    Python Objects have worth and kind.

    Easy object sort consists of String, Integer, Float, Boolean and NoneType.

    Use the kind(object) operate to know the kind of object.

    # string

    a = “abc”

    #

    print(sort(a))

    # Integer

    a = 1

    #

    print(sort(a))

    # Float

    a = 1.0

    #

    print(sort(a))

    # Boolean (True or False)

    a = True

    #

    print(sort(a))

    # NoneType

    a = None

    #

    print(sort(a))

    Compound sorts are listing, tuple and dictionary.

    # listing

    a = [1, “pizza”]

    #

    print(sort(a))

    # tuple

    a = (1, ”pizza”)

    #

    print(sort(a))

    # dictionary

    a = { “a”: 1, “1”: [2]}

    #

    print(sort(a))

    # Record

    numbers = [“one”, “two”, “three”]

    # one

    print(numbers[0])

    # three

    print(numbers[-1])

    numbers.append(“4”)

    # 4

    print(numbers[-1])

    numbers[-1] = “5”

    print(numbers) # [“one”, “two”, “three”, “five”]

    # Tuple

    numbers_2 = (“one”, “two”, “three”)

    # one

    print(numbers_2[0])

    # three

    print(numbers_2[-1])

    # tuple is immutable. we couldn’t change it.

    numbers_2 = (“one”, “two”, “three”, “5”)

    print(numbers_2) # (“one”, “two”, “three”, “5”)

    # dictionary

    numbers_3 = {“one”:1, “two”:2, “three”:3}

    # 1

    print(numbers_3[“one”])

    # 3

    print(numbers_3[“three”])

    numbers_3[“four”] = 4

    # {“one”:1, “two”:2, “three”:3, “4”:4}

    print(numbers_3)

    # dict_keys( [ “one”, “two”, “three”, “four”] )

    print(numbers_3.keys())

    # dict_values( [ 1, 2, 3, 4] )

    print(numbers_3.values())

    # dict_items( [ (“one”, 1), (“two”, 2), (“three”, 3), (“four”,4) ] )

    print(numbers_3.gadgets())

    Booleans in Python:

    1)not operator will adverse True to False and False to True.

    not True returns False

    not False returns True

    2)and operator will return True provided that all of the values are True

    True and False returns False

    True and True returns True

    3)or operator will return True if any of the values is True.

    True or False returns True

    False or False returns False

    Comparability operators

    1)== Operator returns True if each values are identical

    3.0 == 3 returns True

    “3” == 3 returns False

    2)!= Operator returns True if each values are totally different

    3.0 != 3 returns False

    “3” != 3 returns True

    3)> operator returns True if worth 1 is greater than worth 2

    3 > 1 returns True

    3 > 10 returns False

    4)

    3

    3

    5) >= operator returns True if worth 1 is larger than or equal to worth 2

    3 >= 3 returns True

    3 >= 2 returns False

    6)

    3

    3

    7) in operator returns True if value1 is in a listing/dictionary/string of values.

    1 in [1,2,3,4] returns True

    10 in “111” returns False

    Conditional statements.

    If A is True, then “A is True” shall be printed.

    If A is False, then “A is False” shall be printed.

    If A is neither True nor False, then “A is unknown” shall be printed.

    if A==True :

    print(“A is True”)

    elif A == False:

    print(“A is False”)

    else:

    print(“A is unknown”)



    Source link

    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email
    Previous ArticleKit Review 2024 | Smart Passive Income
    Next Article How to Get Rapid YouTube Subscriber Growth for Creators
    FinanceStarGate

    Related Posts

    Machine Learning

    What If Your Portfolio Could Speak for You? | by Lusha Wang | Jun, 2025

    June 14, 2025
    Machine Learning

    YouBot: Understanding YouTube Comments and Chatting Intelligently — An Engineer’s Perspective | by Sercan Teyhani | Jun, 2025

    June 13, 2025
    Machine Learning

    From Accidents to Actuarial Accuracy: The Role of Assumption Validation in Insurance Claim Amount Prediction Using Linear Regression | by Ved Prakash | Jun, 2025

    June 13, 2025
    Add A Comment

    Comments are closed.

    Top Posts

    LLMs + Pandas: How I Use Generative AI to Generate Pandas DataFrame Summaries

    June 3, 2025

    The Method of Moments Estimator for Gaussian Mixture Models

    February 8, 2025

    RISA Labs Raises $3.5M to Fight Treatment Delays with AI-Powered Workflow Automation in Oncology

    April 17, 2025

    Step-by-Step Guide to Build and Deploy an LLM-Powered Chat with Memory in Streamlit

    May 2, 2025

    Build Real World AI Applications with Gemini and Imagen: A Skill Badge offered by Google | by Swapnadeep Debnath | Apr, 2025

    April 13, 2025
    Categories
    • AI Technology
    • Artificial Intelligence
    • Data Science
    • Finance
    • Machine Learning
    • Passive Income
    Most Popular

    Master Prompt Engineering with Google Cloud’s Introductory Prompt Design in Vertex AI Skill Badge | by Keshav Gupta | May, 2025

    May 14, 2025

    Why Paychecks Aren’t Enough Anymore — And What Your Team Really Wants Instead

    April 19, 2025

    Expanding robot perception | MIT News

    February 6, 2025
    Our Picks

    Desvendando o CreateML e o CoreML | by Camila Toniato | May, 2025

    May 8, 2025

    MERN Stack Explained: A Brief Guide to Fundamentals

    March 25, 2025

    What’s next for AI and math

    June 4, 2025
    Categories
    • AI Technology
    • Artificial Intelligence
    • Data Science
    • Finance
    • Machine Learning
    • Passive Income
    • Privacy Policy
    • Disclaimer
    • Terms and Conditions
    • About us
    • Contact us
    Copyright © 2025 Financestargate.com All Rights Reserved.

    Type above and press Enter to search. Press Esc to cancel.