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
Summary

Summary basics of python

Rating
-
Sold
-
Pages
2
Uploaded on
17-05-2023
Written in
2022/2023

It will teach you the fundamentals of Python programming, such as lists, dictionaries, classes, and loops, and the second will help you practice producing clean code. You’ll create three projects in the second part: a Space Invaders arcade game, a series of data visualizations, and a small web application.

Show more Read less
Institution
Course

Content preview

#4 Python Tutorial for Beginners | Variables in Python


In this series on Python, we've covered what Python is, installed software, and worked with operations. Now,
we'll be discussing variables.



What is a Variable?

A variable is a container where you can store values. For example, we can store 2 in a variable called "x".



Variables are useful because they allow us to change the value of the container, and we can use them in
operations. For instance, if we have x = 2 and y = 3, we can add them together: x + y = 5.



Variables can store different types of values, such as integers and strings. We don't need to define the type of
the variable since it automatically takes the value of whatever we assign to it.



Using Variables in Operations

We can use variables in operations just like we do with numbers. For example, we can change the value of x
from 2 to 9.



We can also use underscores to represent the output of the previous operation. For example, if we add x + 10,
we can use the output of that operation (19) in another operation: 19 + y = 22.



We can also fetch individual characters from a string stored in a variable using square brackets. The numbering
of characters starts at 0. For example, the first character of "youtube" is "y" and the last character is "e". We
can also use negative numbers to start counting from the end of the string.



Working with Strings in Python

Let's start by looking at how to access specific characters in a string using index values:



To access the first character, we use index 0.

Written for

Institution
Course

Document information

Uploaded on
May 17, 2023
Number of pages
2
Written in
2022/2023
Type
SUMMARY

Subjects

$7.99
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
rashmib

Get to know the seller

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