0% found this document useful (0 votes)
2 views5 pages

Coding !ST

Coding involves giving instructions to a computer using programming languages like Python, Java, and C++. Python is recommended for beginners due to its simplicity and readability. The document covers basic concepts such as variables, data types, user input, and common errors in Python programming.

Uploaded by

adityagupta8268
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views5 pages

Coding !ST

Coding involves giving instructions to a computer using programming languages like Python, Java, and C++. Python is recommended for beginners due to its simplicity and readability. The document covers basic concepts such as variables, data types, user input, and common errors in Python programming.

Uploaded by

adityagupta8268
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

🧠 What is Coding?

Coding means giving instructions to a computer to perform a specific task.


It's like talking to a machine using a language it understands.

💬 What is a Programming Language?

A programming language is a special language used to write code. Examples:


Python, Java, C++, JavaScript.

Think of it like this:

 Humans speak Hindi or English.

 Computers understand Python, Java, etc.

🐍 Why Learn Python First?

 Simple and easy to read.

 Looks like English.

 Used in web dev, AI, automation, data science, etc.

🔤 First Python Program

python

CopyEdit

print("Hello, World!")

Output:

CopyEdit

Hello, World!

📝 print() is used to show output on the screen.

📌 Basic Concepts You Should Know:


Concept Meaning Example

Variable A container to store data name = "Aditya"

Data Types Type of data stored (number, text, etc.) int, str, float, bool

String Text data "hello" or 'hi'

Integer Whole numbers 5, 100, -23

Float Decimal numbers 3.14, 2.0

Boolean True or False values True, False

Comments Notes inside code (ignored by computer) # This is a comment

🧠 Simple Math in Python

python

CopyEdit

a = 10

b=5

print(a + b) # Addition

print(a - b) # Subtraction

print(a * b) # Multiplication

print(a / b) # Division

🧠 What is a Variable?

A variable is like a box that stores some value.


You give it a name and store data inside it.

🧠 Explanation:

 name is the variable.


 "Aditya" is the value (string).

 = is the assignment operator (it stores the value).

🔢 Common Data Types in Python

Data Type Meaning Example

int Integer (whole num) 10, -5, 0

float Decimal number 3.14, 2.0

str Text (string) "hello", '123'

bool True/False values True, False

🛠️ Type Checking in Python

x = 10

print(type(x)) # Output: <class 'int'>

⌨️ Taking Input from the User

input() function lets you take data from the user at runtime.

name = input("Enter your name: ")

print("Hello", name)

🔍 By default, input is always taken as a string.


🔄 Type Conversion

Converting one data type to another.

age = input("Enter your age: ")

age = int(age) # converting string to int

print("Your age after 5 years will be:", age + 5)

🧠 Use int(), float(), str() to convert types.

🚫 Common Error to Avoid

age = input("Enter age: ")

print(age + 5) # ❌ Error: can't add string and int

Fix:

age = int(input("Enter age: "))

print(age + 5) # ✅ Works fine

🧠 Live Practice Ideas


Ask the user to input their name and print it.

1. Take two numbers as input and print their sum.

2. Take age as input and print "You will be ___ years old after 10 years."

3. Print the data type of any input using type().

You might also like