Getting Started with Python 🐍

Md Adnan Hussain
2 min readMar 12, 2022

So in this lecture, we’ll be covering some basic Python concepts. We’ll be going from how to print “Hello World” all the way up to defining classes in Python.

Some of the key concepts we’ll be covering:-

  • Print statement
  • Input statement
  • Arithmetic Operators
  • Conditional Statements
  • Looping Statements
  • Logical Operators
  • Ternary Operators
  • Lists, Tuple, Dictionaries
  • Functions
  • String Manipulation
  • Classes

Print Statement

Syntax:- print(“<text goes here>”)

Input Statement

Syntax:- input()

Arithmetic Operators

  • +
  • -
  • *
  • /
  • //
  • %

Conditional Statements

These are of three types:-

  • if statement
  • if … else statement
  • if .. elif .. else ladder

Looping Statements

These are of two types:-

  • For Loop
  • While Loop

Q 1. Write a program to enter two numbers and perform all arithmetic operations.

Q 2. Write a program to enter marks of five subjects and calculate total, average and percentage.

Q 3. Write a program to enter length in centimeter and convert it into meter and kilometer, and also convert the same into Equivalents.

Logical Operators

  • and
  • or
  • not

Ternary Operators

Syntax:- <value/variable> if <expression> else <value/variable>

Lists

Syntax:- sample_list = []

Tuple

Syntax:- sample_tuple = ()

Dictionaries

Syntax:- sample_dict = {key : value}

Q 4. Create and develop Python Program to check whether a given number is a palindrome.

Q 5. Create and develop Python Program to check Whether entered number is

Armstrong or Not?

Q 6. Create and develop Python Program to Take three numbers from the user

and print the greatest number.

Functions

Syntax:- def func(<parameters>):

Q 7. Write a python program to calculate the area of different circles. Given the pie = 22/7 and radius of the circles entered by the user using Simple Function, Parameterized Function, Return Type with function, and return type with parameterized Functions.

String Manipulation

  • Accessing
  • len function
  • in / not in
  • count function
  • index function
  • Slicing
  • split function
  • append function
  • startswith function
  • endswith function

Q 8. Python program to check whether the string is Symmetrical or Palindrome.

Q 9. Python program to find uncommon words from two Strings

Q 10. Write a Python program to add ‘ing’ at the end of a given string(length should be at least 3). If the given string already ends with ‘ing’ then add ‘ly’ instead. If the string length of the given string is less than 3, leave it unchanged.

Classes

Syntax:- class sample:

--

--

Md Adnan Hussain
0 Followers

Coding/Dev Enthusiast from Ranchi, India with an Appetite to Learn & explore CSE field. Interested in Web Dev, Cloud Computing, ML AI.