Python Classroom Series – 21/May/2021

Keywords

  • In python keywords are the words that are reserved by python with special meanings.
  • We cannot use keywords as variable names Preview

Multiple variables

  • There are 5 students and 2 courses
student_count = 5
course_count = 2

Getting used to python programs

Program 1

  • Lets write a simple python program to calculate square of a number
  • To implement this program, lets understand about 1 built-in function input()
  • Ensure python extension is installed Preview Preview
  • Python files will have extension of .py
  • Refer Here for the sample create in class

Program 2

  • Lets write simple python program which accepts
    • length
    • breadth
  • Then gives the area of rectangle
  • Area of rectangle = length * breadth
  • Perimeter of rectangle = 2(length + breadth)
  • Refer Here for the code created in class

Program 3:

  • Try to write a program which accepts a number from user and will tell if it even or odd
  • Lets understand some of the python’s operator for comparison
operator symbol
equality ==
inequality !=
less than <
less than or equal <=
greater than >
greater than or equal >=
  • Refer Here for the code written in the class room

Next Steps

  • Understanding
    • if
    • if else
    • if elif statements
    • case

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

About learningthoughtsadmin