Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Presentation

PYTHON NOTES FOR STUDENTS...

Rating
-
Sold
-
Pages
6
Uploaded on
12-08-2024
Written in
2022/2023

Discover comprehensive Python notes that cover essential concepts, coding techniques, and practical examples to enhance your programming skills effectively.

Institution
Course

Content preview

Basic Python Revision Notes
With help from Nitish Mittal



HELP from Documentation
dir(module)
help()


Important Characters and Sets of Characters

 tab \t
 new line \n
 backslash \\
 string " " or ' '
 docstring """ """
 comparison operators == , < , > , <= , >= , !=
 Python type boolean True , False.
 Logical operators not , and , or




Order of Operations (from Emory)

Operator Description
() Parentheses (grouping)
f(args...) Function call
x[index:index] Slicing
x[index] Subscription
x.attribute Attribute reference
** Exponentiation
+x, -x Positive, negative
*, /, % Multiplication, division, remainder
+, - Addition, subtraction
in, not in, is, is not, <, <=, >, >=, Comparisons, membership, identity
<>, !=, ==
not x Boolean NOT
and Boolean AND
or Boolean OR

, Variable Names

 case sensitive
 cannot start with a number (ex, 1_assd is not allowed)




Six Steps to Defining a Function

1. What should your function do? Type a couple of example calls.
2. Pick a meaningful name (often a verb or verb phrase): What is a short answer to "What does
your function do"?
3. Decide how many parameters the function takes and any return values
4. Describe what your function does and any parameters and return values in the docstring
5. Write the body of the function
6. Test your function. Think about edge cases.



Integers and Strings
>>> int(45)
45
>>> int('45')
45
>>> str(45)
'45'
>>> str('45')
'45'
>>> int(str(45))
45




Calling Methods
module_name.function_name(x)

 math.sqrt(x)
 random.randrange(2,5)



Conditionals and Branching

 if
 elif
 else

We have a boolean logic expression for if which works when the Boolean evaluates to True

Written for

Institution
Study
Course
School year
1

Document information

Uploaded on
August 12, 2024
Number of pages
6
Written in
2022/2023
Type
PRESENTATION
Person
Unknown

Subjects

$6.26
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Get to know the seller
Seller avatar
pandeyaarush15022008

Get to know the seller

Seller avatar
pandeyaarush15022008 All Types of Notes
Follow You need to be logged in order to follow users or courses
Sold
-
Member since
1 year
Number of followers
0
Documents
1
Last sold
-

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions