0% found this document useful (0 votes)
2 views1 page

Python Beginner Notes

Python is a versatile programming language used for various applications like web development and data analysis. Key concepts include using print() for output, understanding strings and comments, defining variables, and performing mathematical operations. Important rules include case sensitivity and the use of quotes for strings, while numbers can be used without quotes.

Uploaded by

Ivy Olay
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 views1 page

Python Beginner Notes

Python is a versatile programming language used for various applications like web development and data analysis. Key concepts include using print() for output, understanding strings and comments, defining variables, and performing mathematical operations. Important rules include case sensitivity and the use of quotes for strings, while numbers can be used without quotes.

Uploaded by

Ivy Olay
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

Python Beginner Notes

What is Python?
Python is a friendly and powerful programming language used for web development,
AI, automation, data analysis, and more.

1. print()
Use print() to display text on the screen.
Example: print("Hello!")
• Text must be inside quotes.
• print must be lowercase.
• Every opening parenthesis ( needs a closing ).

2. Strings
A string is text inside single (' ') or double (" ") quotes.
Example: "Hello" or 'Hello'.
Use the opposite quote if your text contains an apostrophe: "It's a great day!".

3. Comments
Comments are notes for humans and are ignored by Python.
Start a comment with #.

4. Variables
A variable stores data.
Example: name = "Alice"
Rules:
• Can contain letters, numbers, and underscores (_).
• Cannot start with a number.
• Python is case-sensitive (age ≠ Age).
• Values can be changed anytime.

5. Numbers
Integer (int): Whole numbers (5, -10).
Float: Decimal numbers (3.14, 1.5).
Numbers do not need quotes.

6. Math Operators
+ Add - Subtract * Multiply / Divide
% Modulo (remainder)
** Exponent (power)
// Floor division (removes decimal part).
/ always returns a float.

7. len()
Use len() to count the number of characters in a string.
Example: len("Hi") = 2
An empty string "" has a length of 0.

Key Points to Remember


• print() displays output.
• Strings need quotes.
• Numbers do not need quotes.
• Variables store data.
• Python is case-sensitive.
• / returns a float, % gives the remainder, ** raises a number to a power, and //
performs floor division.

You might also like