Numeric Data Types | Python for Beginners [13 of 44]




[ad_1]

Numbers are another core data type, and the most common one you’ll use when doing machine learning. As you might expect, Python offers plenty of options for working with numbers. Full ‘Intro to Python’ course on Microsoft Learn: https://aka.ms/MSLearnPython

Sample code: https://aka.ms/PythonGettingStarted
Watch the entire series: https://aka.ms/PythonBeginnerSeries

#microsoftdeveloper #pythonforbeginners #learntocode

Source


[ad_2]

Comment List

  • Microsoft Developer
    November 29, 2020

    float is discontinued in python3 int has now become multipurpose.

  • Microsoft Developer
    November 29, 2020

    days_in_feb = 28
    print("Days in feb", days_in_feb)

  • Microsoft Developer
    November 29, 2020

    My friend is a Java programmer and he said that I should not use comments in variables of comments so much as it does not make the code clean. He said just name the variable so other will understand it. Iam new so I don't know I true it is.

  • Microsoft Developer
    November 29, 2020

    People don't open a random tutorial and start commenting how they could use different ways of string formatting. Because that exact topic is explained in the previous two tutorials.

  • Microsoft Developer
    November 29, 2020

    great job guys but Ms Aunt reminds me old movies actress like she is a time traveler i guess.

  • Microsoft Developer
    November 29, 2020

    The confusion for python to tell if to add or to combine the results would be fixed by having & character.
    5 & " days" = "5 days" 5+5=10. No human in their right mind would want to (5+" days")
    I dont understand why 2019 programming language has issues like that.
    Using & is common sense. Why isnt it implemented ?

  • Microsoft Developer
    November 29, 2020

    i am able to just use print(days_in_feb, 'days in February') the comma separates strings from variables and this works with multiple variables or strings in any combination as long as comma is inserted after each

  • Microsoft Developer
    November 29, 2020

    print(str(days_in_feb) + " days in February")
    print(days_in_feb, "days in February")
    print(f"{days_in_feb} days in February")

    They all so the same thing.

  • Microsoft Developer
    November 29, 2020

    Just use , instead of +
    So it will print first thing before comma and the second thing which is after comma

  • Microsoft Developer
    November 29, 2020

    you 2 are great! keep doing it! amazing…

  • Microsoft Developer
    November 29, 2020

    Very strange, when I try to print ints I get a invalid syntax error.
    "pi = 3.14159

    print(pi)

    SyntaxError: invalid syntax"

  • Microsoft Developer
    November 29, 2020

    This was great! But, isn't this easier instead of specifying integers later?

    first = int(input('Enter first: '))

    second = int(input('Enter second: '))

    print(first + second)

  • Microsoft Developer
    November 29, 2020

    Another way to represent the '28 days in February' output is using the .format() method…

    days_in_feb = 28

    print('{} days in February'.format(days_in_feb))

  • Microsoft Developer
    November 29, 2020

    2:15 I prefer JavaScript's way of handling such "confusion", rather than throw an error: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Operator_Precedence

  • Microsoft Developer
    November 29, 2020

    Great class but there is another way to use numbers and strings without doing type conversion to print out what you need. You could also just use formatting as an option
    days_in_feb = 28

    print(f"{days_in_feb} days in February") # 28 days in February

  • Microsoft Developer
    November 29, 2020

    First comment? NIIIICE

Write a comment