Python Crash Course

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

To run programs in Sublime Text (3)

1- Save the file in your work carpet with the .py extension so it knows is in Python. 2- Select Tools then Build System and select Python 3 to select Python 3 as the default version fo Python. 3- Then select Tools and Build or COMMAND-B to run them.

Naming variables rules (5)

1- Variables can only contain letters, numbers and underscores. 2- They can start with a letter or underscore but not with a number. 3- Avoid using keywords and functions names. 4- Variables name should be short but descriptive: name > n but name_length > name_length_of_persons_name 5- Be careful using l and O confusing with 1 and 0

To run Python programs from a terminal. 1- to change directory. 2- lists files in directory. 3- Choose language and file

1-$ cd Desktop/python_work/ 2-/Desktop/python_work$ ls hello_world.py #.py indicates the file is in Python. 3-/Desktop/python_work$ python hello_world.py #You can also type python3 to specify the type of Python. Hello Python world!

To close the Python interpreter

Press ctrl-D (on the terminal).

5.Crear un sp que solicite dos fechas y devuelva las ordenes con su cliente realizadas entre esas dos fechas, PERO solo debe regresar el 40% de la cantidad de registros . Por ejemplo si el total de registros entre el 01-ene-2000 y el 31-12-2000 son 100 registros, solo debe retornar 40 registros.

create proc [40% of values] (@fecha_1 datetime, @fecha_2 datetime) as begin select top (40)percent p.FirstName, p.LastName, soh.SalesOrderID, soh.OrderDate from Sales.SalesOrderHeader as soh join Person.Person as p on soh.CustomerID=p.BusinessEntityID where soh.OrderDate between @fecha_1 and @fecha_2 end exec [40% of values] '2005-04-15', '2011-09-15'

To create variables

message = "Hello Python world!" message = "Hello Python Crash Course!" print(message) #Python will keep track of the current value —————— Hello Python Crash Course!


Kaugnay na mga set ng pag-aaral

Compensation Administration Chap 12 TNTech

View Set

All the things you need to review

View Set

Basic Insurance Concepts and Principles

View Set

Chapter 6:Values,Ethics,and Advocacy PrepU

View Set

GE 101 - CH 3 Physical Geography - Multiple Choice

View Set

how to say hi in Spanish and French and

View Set