EECS 183 Discussion #9: It’s time to “Git” Python! November 22nd, 2016

Slides:



Advertisements
Similar presentations
Μαθαίνοντας Python [Κ4] ‘Guess the Number’
Advertisements

Computer Science 1620 Loops.
Slide 1 Summary Two basic concepts: variables and assignments Some C++ practical issues: division rule, operator precedence  Sequential structure of a.
Starting Out with C++: Early Objects 5/e © 2006 Pearson Education. All Rights Reserved Starting Out with C++: Early Objects 5 th Edition Chapter 5 Looping.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with C++ Early Objects Sixth Edition Chapter 5: Looping by Tony.
Your First C++ Program Aug 27, /27/08 CS 150 Introduction to Computer Science I C++  Based on the C programming language  One of today’s most.
Python November 18, Unit 7. So Far We can get user input We can create variables We can convert values from one type to another using functions We can.
CS31: Introduction to Computer Science I Discussion 1A 4/2/2010 Sungwon Yang
C Programming. Chapter – 1 Introduction Study Book for one month – 25% Learning rate Use Compiler for one month – 60%
ASP.NET Programming with C# and SQL Server First Edition Chapter 3 Using Functions, Methods, and Control Structures.
Chapter 4: Decision Making with Control Structures and Statements JavaScript - Introductory.
Agenda Exam #1 Review Modulus Conditionals Boolean Algebra Reading: Chapter Homework #5.
 Pearson Education, Inc. All rights reserved Introduction to Java Applications.
CompSci 100E 2.1 Java Basics - Expressions  Literals  A literal is a constant value also called a self-defining term  Possibilities: o Object: null,
Control Structures II (Repetition). Objectives In this chapter you will: Learn about repetition (looping) control structures Explore how to construct.
Chapter 3 Functions, Events, and Control Structures JavaScript, Third Edition.
Python uses boolean variables to evaluate conditions. The boolean values True and False are returned when an expression is compared or evaluated.
CSCI/CMPE 4341 Topic: Programming in Python Review: Exam I Xiang Lian The University of Texas – Pan American Edinburg, TX 78539
CS161 Topic #16 1 Today in CS161 Lecture #16 Prepare for the Final Reviewing all Topics this term Variables If Statements Loops (do while, while, for)
Introduction to Python Dr. José M. Reyes Álamo. 2 Three Rules of Programming Rule 1: Think before you program Rule 2: A program is a human-readable set.
C++ / G4MICE Course Session 1 - Introduction Edit text files in a UNIX environment. Use the g++ compiler to compile a single C++ file. Understand the C++
Jim Havrilla. Invoking Python Just type “python –m script.py [arg]” or “python –c command [arg]” To exit, quit() or Control-D is used To just use the.
Python Let’s get started!.
ICS3U_FileIO.ppt File Input/Output (I/O)‏ ICS3U_FileIO.ppt File I/O Declare a file object File myFile = new File("billy.txt"); a file object whose name.
General Computer Science for Engineers CISC 106 Lecture 12 James Atlas Computer and Information Sciences 08/03/2009.
Alternate Version of STARTING OUT WITH C++ 4 th Edition Chapter 5 Looping.
2: Basics Basics Programming C# © 2003 DevelopMentor, Inc. 12/1/2003.
C Language 1 Program Looping. C Language2 Topics Program looping Program looping Relational operators / expressions Relational operators / expressions.
1 8/30/06CS150 Introduction to Computer Science 1 Your First C++ Program.
EECS 183 Discussion #10: I’m actually Alex Trebek. November 15th, 2016
Information and Computer Sciences University of Hawaii, Manoa
Basic concepts of C++ Presented by Prof. Satyajit De
4. Java language basics: Function
Whatcha doin'? Aims: To start using Python. To understand loops.
User-Written Functions
Discussion #11 11/21/16.
A Playful Introduction to Programming by Jason R. Briggs
Python Let’s get started!.
Introduction to Python
Discussion 11 Final Project / Git.
Miscellaneous Items Loop control, block labels, unless/until, backwards syntax for “if” statements, split, join, substring, length, logical operators,
CS1010 Discussion Group 11 Week 6 – One dimensional arrays.
Control Structures II (Repetition)
Python is a general-purpose interpreted, interactive, object-oriented, and high-level programming language. It was created by Guido van Rossum during.
Introduction to C++ October 2, 2017.
Chapter 5: Looping Starting Out with C++ Early Objects Seventh Edition
Student Book An Introduction
Shell scripts on Pegasus 2
Engineering Innovation Center
Engineering Innovation Center
MATLAB: Structures and File I/O
Arrays & Functions Lesson xx
Alternate Version of STARTING OUT WITH C++ 4th Edition
CS1100 Computational Engineering
Introduction to Python
Topic 1: Problem Solving
Summary Two basic concepts: variables and assignments Basic types:
Git CS Fall 2018.
Computing Fundamentals
SE1H421 Procedural Programming LECTURE 4 Operators & Conditionals (1)
7 Arrays.
COMPUTER PROGRAMMING SKILLS
Javascript Chapter 19 and 20 5/3/2019.
Unit 3: Variables in Java
Comparing Python and Java
Introduction to C Programming
Python Simple file reading
Problem 1 Given n, calculate 2n
Hardware is… Software is…
Introduction to Python
Presentation transcript:

EECS 183 Discussion #9: It’s time to “Git” Python! November 22nd, 2016 Kevin Lee (mrkevin)

Final Projects Tip #1: Start early!!! Tip #2: Not lying. Remember, this is a group project! You need to meet up with your team members. Tip #3: Work as a team together, not as many individuals Try not to split up work individually, but rather tackle these problems together! Counter-argument: Reaches Tip #4: If you need motivation, remember that companies will be at the final showcase! Last year we had companies such as JP Morgan Chase walking around seeing projects!

Github What is it, and how do we use it?

Github What is Github?  VERSION CONTROL Collaboration Online backup Github is version control, meaning the opportunity to go back to any old code you ever wrote. Collaboration Online backup Timeline of Project Progress Accountability You can see who has written what in your project’s code

Git Terminal How does one navigate the dark, scary terminal? ls : List files / folders in your directory pwd : Print Working Directory cd [path] : Change Directory to a specified path / place q : Quit mkdir [path] : Make directory Note: The most important ones are ls and cd!

Github Flow

Github Flow git clone: One-time command to synchronize repository to your local computer. git status: Shows what files have changed since last push. git pull: Grab files from repository, similar to git clone but more common. Edit files: Yep. git add: Add changed files to prepare it for pushing. git commit: Write a message associated with files, final preparation for pushing. git push: Push files to repository. Note: The most common lines you will be writing are: “git add, git commit, git push”.

Python Hiss hiss…!

Python vs. C++ Differences between C++ and Python: True and False are capitals Python floors with int division C++: -3 / 2 = -1 Python: -3 / 2 = -2 No variable declarations (!!!) Automatically interprets based on what you assign it to! my_string = “Hello” my_int = 5 Python has no ++ operator Arrays vs. List Next slide!

Arrays vs. Lists C++ vs. Python C++ PYTHON C++ has arrays. Say there is an array of size 5. arr[2] = 3rd element. arr[-2] = Invalid Python has lists. Say there is a list of size 5. list[2] = 3rd element. list[-2] = 2nd to last element. C++ PYTHON

New Things in Python Power function is ** Example: 3 ** 4 = 34 Multiplying strings Example: “Hello” * 2 = “HelloHello” Keyword: print is like cout but there is no “<<” needed Print automatically puts a new line to the end of the output, unless used a comma. Example:

New Things in Python raw_input([prompt]) is how you can extract the input stream (a.k.a. cin) But what about inputting an int?

Python’s Syntax No semicolons! No curly braces! No parentheses for loops and conditionals! Python Traits: Colons are used in Python Everything is decided by indents This determines scope as well!

If / Elif / Else If / Else statements in C++ are similar to Python in logic, just not syntax. PYTHON C++

Loops While loops: For Loops: Note: Index is not 0, 1, 2. Index refers to the actual object inside that list!

Questions?

Have a FANTASTIC Thanksgiving!

Extra Slides (Just for your information!)

Printing Variables Very similar to C, but not C++ You can always use the comma operator but it gets very tedious very fast. Instead, use: %s for string %d for int (doubles will get truncated) %f for floats (if you want to save decimals) Example:

Python functions Is Python pass by reference? Or value? Python is… a bit of both! Python acts like pass-by-value when: Variable contains simple value like int Variable refers to object with no member function that can modify it (strings). Python acts like pass-by-reference when: Variable refers to an object with member functions that can modify it. In English… If it’s something simple like string or int, the answer is pass-by-value. You must return a new value to hold the answer. If it’s something like a list, then it’s pass- by-reference because a “list” has functions like .append() that changes it internally.