Day 3 : Python Syntax: Basic Concepts After – Hello, World!

Day 3 : Python Syntax: Basic Concepts After – Hello, World!

Python in 30 Days: A Practical and Theoretical Approach for Beginner.

image 43 Simply Creative Minds

Day 3 : Python Syntax: Basic Concepts After -” Hello, World!”

We’ve written your first Python program with “Hello, World!” Day 2 it’s time to dive into some more basic syntax.

This will help you get comfortable writing Python code that does more than just print text to the screen.

We will use live Editor to run each program of Python

1. Variables and Data Types

In Python, variables are used to store information.

Here’s how to create variables and assign them values:

# Assigning values to variables
name = "John"
age = 25
height = 5.9

# Printing variables
print(name)   # Output: John
print(age)    # Output: 25
print(height) # Output: 5.9
image 8 Simply Creative Minds

Explanation:

  • Strings are enclosed in quotes (" " or ' ').
  • Integers are whole numbers like 25.
  • Floats are decimal numbers, like 5.9.

2. Basic Arithmetic Operations

You can perform arithmetic operations using operators like +-*/, and others.

# Basic Arithmetic
a = 10
b = 5

sum = a + b          # Addition
difference = a - b   # Subtraction
product = a * b      # Multiplication
quotient = a / b     # Division
modulus = a % b      # Modulus (remainder)
power = a ** b       # Exponentiation

print(sum)           # Output: 15
print(difference)    # Output: 5
print(product)       # Output: 50
print(quotient)      # Output: 2.0
print(modulus)       # Output: 0
print(power)         # Output: 100000
image 9 Simply Creative Minds

Summary

  • Variables and Data Types: Storing data like strings, integers, and floats.
  • Arithmetic Operations: Performing calculations.

Tomorrow we will learn

Strings: Working with text and manipulating strings.

Lists: Storing and accessing multiple items.

Happy Coding and Stay Tuned 🙂

Kind is always cool !!!

Share knowledge to gain knowledge !!!!

Be kind and treat people with respect !!!

If you find my blog helpful, then please subscribe, claps and follow to support 🙂

image 34 Simply Creative Minds

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

Your email address will not be published. Required fields are marked *