100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4.2 TrustPilot
logo-home
Other

python cheat sheet

Rating
-
Sold
-
Pages
10
Uploaded on
03-12-2022
Written in
2022/2023

this is full python python cheat sheet by which you can revise all your python syllabus in a day this sheet will help you a lot

Institution
Course









Whoops! We can’t load your doc right now. Try again or contact support.

Written for

Institution
Course

Document information

Uploaded on
December 3, 2022
Number of pages
10
Written in
2022/2023
Type
Other
Person
Unknown

Subjects

Content preview

Variables .................................................................................................. 5
Comments ................................................................................................. 5
Receiving Input ........................................................................................5
Strings ......................................................................................................6
Arithmetic Operations .............................................................................7
If Statements ............................................................................................8
Comparison operators ............................................................................ 8
While loops ............................................................................................... 8
For loops ...................................................................................................9
Lists ........................................................................................................... 9
Tuples ........................................................................................................9
Dictionaries.............................................................................................10
Functions .................................................................................................10
Exceptions................................................................................................ 11
Classes...................................................................................................... 11
Inheritance .............................................................................................12
Modules ................................................................................................... 12
Packages ..................................................................................................13
Python Standard Library ......................................................................13
Pypi .........................................................................................................14
Want to Become a Python Expert? ........................................................ 14

, Variables
We use variables to temporarily store data in computer’s memory.

price = 10

rating = 4.9

course_name = ‘Python for Beginners’

is_published = True

In the above example,

• price is an integer (a whole number without a decimal point)

• rating is a float (a number with a decimal point)

• course_name is a string (a sequence of characters)

• is_published is a boolean. Boolean values can be True or False.



Comments
We use comments to add notes to our code. Good comments explain the hows and
whys, not what the code does. That should be reflected in the code itself. Use
comments to add reminders to yourself or other developers, or also explain your
assumptions and the reasons you’ve written code in a certain way.

# This is a comment and it won’t get executed.
# Our comments can be multiple lines.



Receiving Input
We can receive input from the user by calling the input() function.

birth_year = int(input(‘Birth year: ‘))

The input() function always returns data as a string. So, we’re converting the
result into an integer by calling the built-in int() function.
$7.99
Get access to the full document:

100% satisfaction guarantee
Immediately available after payment
Both online and in PDF
No strings attached

Get to know the seller
Seller avatar
siddhantyadav

Get to know the seller

Seller avatar
siddhantyadav psit che
Follow You need to be logged in order to follow users or courses
Sold
0
Member since
3 year
Number of followers
0
Documents
2
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

Frequently asked questions