100% de satisfacción garantizada Inmediatamente disponible después del pago Tanto en línea como en PDF No estas atado a nada 4,6 TrustPilot
logo-home
Notas de lectura

Complete Python Programming from Basics to Advanced Concepts

Puntuación
-
Vendido
-
Páginas
7
Subido en
11-06-2023
Escrito en
2022/2023

All the notes gives a very good understanding of the basic and the advanced concepts in python programming, this also covers the area of OOP.

Institución
Grado









Ups! No podemos cargar tu documento ahora. Inténtalo de nuevo o contacta con soporte.

Escuela, estudio y materia

Institución
Estudio
Desconocido
Grado

Información del documento

Subido en
11 de junio de 2023
Número de páginas
7
Escrito en
2022/2023
Tipo
Notas de lectura
Profesor(es)
Mr.saman
Contiene
Todas las clases

Temas

Vista previa del contenido

6/10/23, 2:07 PM Variables and Data Types.ipynb - Colaboratory



Variables and Data Types 🔥


Variables 🚀

Variable are containers for storing data values.



Creating a Variable
A variable is created the moment you first assign a value to it.


x = 5
print(x)

5


y = "Nazhim"
print(y)

Nazhim


z = 2.56
print(z)

2.56


a = True
b = False

print(a)
print(b)

True
False


Variables do not need to be declared with any particular type, and can even change type after they have been set.


# Firstly the variable 'number' is stores 5
number = 5
print(number)

# Now, we update the content of the variable 'number'
number = "Kevin"
print(number)


5
Kevin



What are comments ?
Comments can be used to explain Python code.

Comments can be used to make the code more readable.

Comments can be used to prevent execution when testing code.

Comments starts with a #

Comments have no affect with the program code, its only used to give the user some meaning of the code


Single Line Comment

# This is a single line comment
https://colab.research.google.com/drive/1TYB6-QkORCNTdH4X2b8C8z0eJDP6xxRF 1/7

, 6/10/23, 2:07 PM Variables and Data Types.ipynb - Colaboratory
g



Multi Line Comment

# This
# is
# a
# multi
# line
# comment



Casting
If you want to specify the data type of a variable, this can be done with casting.

You can get the data type of a variable with the type() function.


x = str(3) # x will be '3'
y = int(3) # y will be 3
z = float(3) # z will be 3.0

print(x, y, z)
print(type(x), type(y), type(z))

3 3 3.0
<class 'str'> <class 'int'> <class 'float'>



Single or Double Quotes in Strings

x = "Nazhim"
y = 'Nazhim'

print(x)
print(y)

Nazhim
Nazhim



Case Sensitive
Variable names are case-sensitive


a = 4
A = "Sally"

# A will not overwrite a

print(a, A)

4 Sally



Quick Code Summary Example of what Variables and Comments

name = "Nazhim" # variable 'name' stores the String 'Nazhim'
age = 25 # variable 'age' stores the integer number 25
height = 6.1 # variable 'height' stores the decimal value 6.1



# Now let's print out the results of the variables
print("My name is " + name) # we don't cast the name variable because its already in the same type which is String
print("I am " + str(age) + " years old")
print("I am " + str(height) + " feet tall")


My name is Nazhim
I am 25 years old
I am 6.1 feet tall
https://colab.research.google.com/drive/1TYB6-QkORCNTdH4X2b8C8z0eJDP6xxRF 2/7
$7.99
Accede al documento completo:

100% de satisfacción garantizada
Inmediatamente disponible después del pago
Tanto en línea como en PDF
No estas atado a nada

Conoce al vendedor
Seller avatar
nazhimkalam

Conoce al vendedor

Seller avatar
nazhimkalam University of Westminster
Seguir Necesitas iniciar sesión para seguir a otros usuarios o asignaturas
Vendido
0
Miembro desde
2 año
Número de seguidores
0
Documentos
1
Última venta
-

0.0

0 reseñas

5
0
4
0
3
0
2
0
1
0

Recientemente visto por ti

Por qué los estudiantes eligen Stuvia

Creado por compañeros estudiantes, verificado por reseñas

Calidad en la que puedes confiar: escrito por estudiantes que aprobaron y evaluado por otros que han usado estos resúmenes.

¿No estás satisfecho? Elige otro documento

¡No te preocupes! Puedes elegir directamente otro documento que se ajuste mejor a lo que buscas.

Paga como quieras, empieza a estudiar al instante

Sin suscripción, sin compromisos. Paga como estés acostumbrado con tarjeta de crédito y descarga tu documento PDF inmediatamente.

Student with book image

“Comprado, descargado y aprobado. Así de fácil puede ser.”

Alisha Student

Preguntas frecuentes