0% found this document useful (0 votes)
2 views2 pages

IPython Shell

The document explains the Python shell and scripts, highlighting that scripts are text files with a .py extension that allow for structured coding without repetitive typing. It discusses the creation and usage of variables in Python, including different data types such as float, string, and boolean. Additionally, it emphasizes the importance of using parentheses with print statements and the case sensitivity of variable names.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views2 pages

IPython Shell

The document explains the Python shell and scripts, highlighting that scripts are text files with a .py extension that allow for structured coding without repetitive typing. It discusses the creation and usage of variables in Python, including different data types such as float, string, and boolean. Additionally, it emphasizes the importance of using parentheses with print statements and the case sensitivity of variable names.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Python

IPython Shell

Python shell, a place where you can type Python code and immediately see the results.
In DataCamp's exercise interface, this shell is embedded here.

Python scripts
these python scripts are simply text files with the extension (dot) py. It's basically a list of Python
commands that are executed, almost as if you were typing the commands in the shell yourself,
line by line. You will not get an out simply by typing the answer you have to put the word script in
front of your program if you want to get an output if you do not do this you will not get an
answerutting your code in Python scripts instead of manually retyping every step interactively
will help you to keep structure and avoid retyping everything over and over again if you want to
make a change; you simply make the change in the script, and rerun the entire thing. When
using print don’t forget to use parentheses
multiplication=*
division=/

2. Variable
You can do this by defining a variable, with a specific, case-sensitive name. Once you
create (or declare) such a variable, you can later call up its value by typing the variable
name. Suppose you measure your height and weight, in metric units: you are 1.79
meters tall, and weigh 68.7 kilograms. You can assign these values to two variables,
named height and weight, with an equals sign: If you now type the name of the variable,
height, Python looks for the variable name, retrieves its value, and prints it out.
n Python, a variable allows you to refer to a value with a name. To create a
variable x with a value of 5, you use =, like this example
remember to leave spaces between the variables and the units of calculation
Next to numerical data types, there are three other very common data types:
 float, or floating point: a number that has both an integer and fractional part,
separated by a point. 1.1, is an example of a float.
 str, or string: a type to represent text. You can use single or double quotes to
build a string.
 bool, or boolean: a type to represent logical values. It can only
be True or False (the capitalization is important!).

Variables come in different types in Python. You can see the type of a variable by using type(). For
example, to see type of a, execute: type(a).

Different types behave differently in Python. When you sum two strings, for example, you'll get
different behavior than when you sum two integers or two booleans.
Python

You might also like