Python for Beginners – Learn Python in 1 Hour

32 Comments



This Python tutorial for beginners show how to get started with Python quickly. Learn to code in 1 hour! Watch this tutorial get started!
👍 Subscribe for more Python tutorials like this: https://goo.gl/6PYaGF
🔥 Want to learn more? Watch my complete Python course: https://youtu.be/_uQrJ0TkZlc

📕 Get my FREE Python cheat sheet: http://bit.ly/2Gp80s6

Courses: https://codewithmosh.com
Twitter: https://twitter.com/moshhamedani
Facebook: https://www.facebook.com/programmingwithmosh/
Blog: http://programmingwithmosh.com

#Python, #MachineLearning, #WebDevelopment

📔 Python Exercises for Beginners: https://goo.gl/1XnQB1

⭐ My Favorite Python Books
– Python Crash Course: https://amzn.to/2GqMdjG
– Automate the Boring Stuff with Python: https://amzn.to/2N71d6S
– A Smarter Way to Learn Python: https://amzn.to/2UZa6lE
– Machine Learning for Absolute Beginners: https://amzn.to/2Gs0koL
– Hands-on Machine Learning with scikit-learn and TensorFlow: https://amzn.to/2IdUuJy

TABLE OF CONTENT

0:00:00 Introduction
0:00:30 What You Can Do With Python
0:01:15 Your First Python Program
0:05:30 Variables
0:09:08 Receiving Input
0:10:48 Type Conversion
0:18:49 Strings
0:23:41 Arithmetic Operators
0:25:59 Operator Precedence
0:27:11 Comparison Operators
0:28:52 Logical Operators
0:31:06 If Statements
0:36:16 Exercise
0:41:42 While Loops
0:45:11 Lists
0:48:47 List Methods
0:52:16 For Loops
0:54:54 The range() Function
0:57:43 Tuples

source

32 Comments
    • blank
      Programming with Mosh
      May 11, 2022 14:15 pm Reply

      A good friend of mine has started a study channel to help people who need focus and motivation. I've seen her videos and they look great! These videos are great for anyone coding or learning to code. Check them out: https://youtu.be/DtTPetY7Rrw

    • blank
      Christyna Sangeetha
      May 11, 2022 14:15 pm Reply

      Data science

    • blank
      Neil Roy
      May 11, 2022 14:15 pm Reply

      challenge(38:39)
      print('lbs to kg or kg to lbs converter')

      weight = input("your weight: ")

      unit = input("its in for kg type k or for lbs type l: ")

      if unit == "k":

      print("your weight in lbs is")

      print(float(weight) * 2.20462 )

      elif unit == "l":

      print('your weight in kgs is' )

      print(float(weight) / 2.20462 )

    • blank
      Neil Roy
      May 11, 2022 14:15 pm Reply

      exercise (9:06)
      first_name = ("John")

      second_name = ("Smith")

      age = ("20")

      status = ("new")

      print(second_name)

      print(first_name)

      print(age)

      print(status)

    • blank
      Yom
      May 11, 2022 14:15 pm Reply

      Tip for anyone who's not used to this type of videos: If you're havng trouble getting through the course, put on some background music so you can get yourself motivated to learn!

    • blank
      SAJID MAHMOOD
      May 11, 2022 14:15 pm Reply

      You said by 13 divided by 2 at 27th minute

    • blank
      Ted Sassi
      May 11, 2022 14:15 pm Reply

      Would anyone be able to answer my question?

      For the Exercise 36 minutes in, I wrote:

      Weight = int(input("Weight: "))
      Unit = input("(K)g or (L)s: ")
      if Unit == "K" or "k":
      print(Weight * 2.20462)
      if Unit == "l" or "L":
      print(Weight * 0.453592)

      However, whenever I enter either K, k, l, or L into the terminal window, I get an answer for both my if functions. So the terminal window ends up looking like:
      Weight: 170
      (K)g or (L)s: k
      374.7854
      77.11064

      I thought if the answer to the input didn't correspond to an option in the if function, then the subsequent piece below (with the indentation) would not run?

      Would anyone be able to tell me why this answer didn't work?

    • blank
      Shymekk
      May 11, 2022 14:15 pm Reply

      its really enjoyable and easy to understand even though i do not understand everything that you are saying beacouse i was not born in a english languaged country.
      This video inspired me to start programming thank you Mosh.

    • blank
      maureen o’brien
      May 11, 2022 14:15 pm Reply

      Data science. Thank you for this!

    • blank
      Xuan Power
      May 11, 2022 14:15 pm Reply

      I want to learn to transition into a cyber sec/Cloud. Tired of driving a semi truck.
      If you have a LinkedIn, post it below, let’s connect! See everyone at the top 💪🙏

    • blank
      DHAVAL CHAVDA
      May 11, 2022 14:15 pm Reply

      patient_name = "john smith"

      years_old = 20

      patient = "new"

      print(patient_name)

      print(years_old)

      print(patient)

    • blank
      Ali Vendeta
      May 11, 2022 14:15 pm Reply

      آموزش فارسی دارید؟ این شکل یکم سخت میشه🥲

    • blank
      dusty
      May 11, 2022 14:15 pm Reply

      36:16
      it took a while but i got there eventually

      Weight = input("Weight: ")

      form = input("(K)g or (L)bs: ")

      if ("K")== form or ("k")== form:

      Weight_in_pound = float(Weight) * float(2.20462)

      print("Weight in pound: " +str(Weight_in_pound))

      elif ("L")== form or ("l")== form:

      weight_in_kg = float(Weight) * float(0.453592)

      print("weight in kg: "+str(weight_in_kg))

    • blank
      DDP LOP
      May 11, 2022 14:15 pm Reply

      Exercise 1:
      Age = 20
      Name = 'Smith'
      Situation = "a new patient."
      print(Name, "is", Situation, 'He is', Age, "years old.")

    • blank
      Tuấn Nguyễn
      May 11, 2022 14:15 pm Reply

      0:36:16 Exercise
      weight = input("Weight: ")

      kg_or_p = input("(K)g or (L)bs: ")

      if kg_or_p == "l" or kg_or_p == "L": # kg_or_p.upper() == "L":

      result = float(weight) * 0.45

      print("Weight in Kg: " + str(result))

      elif kg_or_p == "k" or kg_or_p == "K": # k g_or_p.upper() == "K":

      result = float(weight) / 0.45

      print("Weight in Kg: " + str(result))

    • blank
      Le Cadre
      May 11, 2022 14:15 pm Reply

      are u from lettland ?

    • blank
      Anything With Rice
      May 11, 2022 14:15 pm Reply

      Thank you so much for teaching!! You're such a good teacher!

    • blank
      Westside Courtesy
      May 11, 2022 14:15 pm Reply

      I’m learning because I’m tired of being a burden on society

    • blank
      Naa Omo
      May 11, 2022 14:15 pm Reply

      name = "John_Smith"

      age = 20

      status = "New Patient"

      print(name)

      print(age)

      print(status)

    • blank
      HARDBRO GAMING
      May 11, 2022 14:15 pm Reply

      I am 13. Is this a good language for me learn if i want to get into coding or should I start with something else?

    • blank
      Amber Krishna
      May 11, 2022 14:15 pm Reply

      hi I am 11 years old and me and my friends are making a robot this would really help I am aahana by the way hope you create such wonderful videos ,

    • blank
      dawud oguntoyinbo
      May 11, 2022 14:15 pm Reply

      Thanks for your lessons. You're a very good tutor. I learned so much so quickly.

    • blank
      Matthew Mckeen
      May 11, 2022 14:15 pm Reply

      Weight Converter Exercise:

      import math

      active = True

      while active:

      Weight = float(input("How much do you weigh?: "))

      conversion = input("nIs that in KG or LBS?: ")

      kg = Weight / 2.205

      lbs = Weight * 2.205

      if conversion in ["KG", "kg", "Kg", "K", "k"]:

      print(f"You weigh {round(lbs, 1)}Lbsn")

      break

      elif conversion in ["LBS", "lbs", "Lbs", "L", "l"]:

      print(f"You weigh {round(kg, 1)}Kgn")

      break

      else:

      print("Invalid command, try again!")

      continue

      else:

      print("Not active")

    • blank
      Master Cuber
      May 11, 2022 14:15 pm Reply

      13 years old looking for a part-time job learning Data Science

    • blank
      Kerrigan White
      May 11, 2022 14:15 pm Reply

      I've hated programming and felt that I'm worthless at it, but I need to learn python for work. I'm only 20 minutes in and all of this is making so much sense to me, and it doesn't only make sense but it's fun as well. I couldn't for my life code anything out of my own head before, other than "Hello world!". This is really life changing for me, thank you so much.

    • blank
      Tsegaye Bekele
      May 11, 2022 14:15 pm Reply

      Web development

    • blank
      Oyadiran Isaiah
      May 11, 2022 14:15 pm Reply

      I'm learning as a data scientist sir

    • blank
      JK Curti
      May 11, 2022 14:15 pm Reply

      Using Python to program IoT devices and with Microsoft(TM) SQL backend DB. Will also be doing some Web and Android App creation later, so integrated Jango will be greaat for Web side. Great primer! Thanks very much for your gift of training to humanity.

    • blank
      Shoumitro Kumar Biswas
      May 11, 2022 14:15 pm Reply

      I used the following code for Weight conversion excercise:
      weight = input ("Weight: ")

      Kg_or_Lbs = input("(K)g or (L)bs: ")

      if Kg_or_Lbs =="K" or Kg_or_Lbs =="k":

      print("Weight in Lbs: "+ str(float(weight)*2.20))

      elif Kg_or_Lbs =="L" or Kg_or_Lbs =="l":

      print("Weight in KG " + str(float(weight)/2.20))

      else:

      print("Error in Input")

    • blank
      Mr. Duck
      May 11, 2022 14:15 pm Reply

      26:00
      Adding on to this, the concept in math is called "PEMDAS" which dictates the order of operations at which the equation is evaluated. The equation is evaluated in order as…

      P: Parenthesis
      E: Exponent
      M: Multiplication
      D: Division
      A: Addition
      S: Subtraction

    • blank
      Sharon Davis
      May 11, 2022 14:15 pm Reply

      I’m learning for web development and a new career path after retiring as a teacher. Thank you, Mosh🙏🏽

    • blank
      DiverseGameplays
      May 11, 2022 14:15 pm Reply

      i fucking hate python i tried it and no fucking keys on my keyboard works, hate it

Leave us a comment