Hello World.

坐下来

Don't worry. This is not Chinese Cultural Club.

Welcome.

First off, thanks for joining programming and not hell robotics. 

You will remember and treasure this decision for many many years to come.

Let's start off with a customary introduction.

I am Peanut.

I am technically the CCAL of RIICC.

But the actual Eternal Leader of RIICC is Douglas. He is the soft toy dog you saw last week.

Algorithms

- Computer Science

- Deals with CS-related concepts such as various algorithms used to solve problems in discrete mathematics.

 

- Culminates in NOI.

 

- C, C++, Java, etc.

Web Dev

- Server-side and client-side programming for web applications.

 

- HTML, CSS, JS, PHP, Django, Ruby on Rails, etc.

Arnold Tan (Y3)

- Suanner.

- Good at everything.

 

- Does way more web development, specialises in his favourite NodeJS.

 

- Does robotics in NJRC and stuff, very suan.

 

- Probably going to see him a lot in the future.

Bradley Teo (Y4)

- Also a Suanner.

- Good at everything.

 

- Not here today due to doing some Bio stuff.

 

- Draws awesome digital stuff.

- Can do algorithms.

 

- Does a lot of front-end work for web development.

Now let's start with you new guys.

People Who Signed Up

Xavier

Charles

Darrell

Ryan

Jensen

Wenrui

Victor

Matthew

DingZheng

Charles

Albert

Zihan

Zhe Ming

 

And last but not least...

Gamanizaw@Roland Zaw Win

??????????????????????????????????

??????????????????????????????????

Track A

Track B
Track C

Track A1

- Basically NOI training.

 

- Conducted by Peanut.

 

- Discrete mathematics, similar in standard to SMO, SJPO, SJChO, etc.

 

- For the math and science-inclined.

Track A2

- Computer Science

 

- Conducted by Bradley.

 

- Focuses on miscellaneous computer science topics such as encryption, AI, information theory, etc.

 

- Rather superficial but interesting.

Track B

- Web Programming

 

- Conducted by Arnold.

 

- Extension of CS syllabus: advanced HTML CSS JS.

 

- For the more capable ones, we focus on backend management such as databases as well.

Track C

- Graphic Design

 

- Conducted by ???

 

- Teaches you how to make good design (which we ourselves can't really do).

 

- Fonts, color schemes, etc.

Basic Programming

For those who can already code:

You have 20 minutes.

 

Write a program is as many languages as possible to calculate your GPA.

 

>= 80: 4.0             55 to 59: 2.4

70 to 79: 3.6        50 to 54: 2.0

65 to 69: 3.2        45 to 49: 1.6

60 to 64: 2.8        40 to 44: 1.2

                  < 40: 0.8

For those who cannot already code:

Find another person who can already code.

 

Sit down beside them and stare at what they are doing. Try and make the best sense of it you can.

Languages?

  • C?
  • C++?
  • Java?
  • Python?
  • JavaScript?
  • BASIC?
  • Ruby?

 

  • C#?
  • FORTRAN?
  • Pascal?

 

 

Any others?

Code Monkey Presentation

function gpa(x):
   if x is not None:
      if x >= 80:
         return 4.0
      elif x >= 70:
         return 3.6
      elif x >= 65:
         return 3.2
      elif x >= 60:
         return 2.8
      elif x >= 55:
         return 2.4
      elif x >= 50:
         return 2.0
      elif x >= 45:
         return 1.6
      elif x >= 40:
         return 1.2
      else:
         return 0.8   
class HelloWorld {
   public static void main(String args[]) {
      System.out.println("Hello World!");
   }
}
#include <stdio.h>

int main() {
   printf("Hello World\n");
}
#include <iostream>

int main() {
   std::cout << "Hello World" << std::endl;
}
print("Hello World")
puts 'Hello World'
10 PRINT "Hello World"
program helloworld;
begin
   writeln("Hello World");
end
namespace HelloWorld {
   class Hello {
      static void Main() {
            Console.WriteLine("Hello World");
      }
   }
}

Types of Languages

Compiled

- C, C++, C#, Java

 

- Source code is put into a compiler to be translated into executable machine code before running.

 

- Fast

Interpreted

- Python, Ruby

 

- Source code is converted into machine code and run "on-the-fly"

 

- About 50-100x slower

 

- Faster development time

What Is Programming?

Computers are FAST.

But computers are RETARDED.

 

Example: What is my GPA?

Your GPA is 3.2

Your GPA is 4.0

Your GPA is 2.0

Your GPA is 3.6

Example: What is my GPA?

WTF

WTF

WTF

WTF

The Computer Needs to Know What To Do.

You are here to help it know what to do.

Everything a computer needs to do has to be

decomposed into a series of if/else and mathematical operations.

Example: What is my GPA?

program:
   calculate GPA

Example: What is my GPA?

program:
   input an integer x.
   calculate GPA according to limits.
   output GPA.

Example: What is my GPA?

program:
   declare a 4-byte memory space for integer x.
   input x.
   
   check if x >= 80:
      if so, output 4.0
   check if x >= 70:
      if so, output 3.6
   check if x >= 65:
      if so, output 3.2
   check if x >= 60:
      if so, output 2.8
   ... and so on ...

Learning Your First Language

Sit beside someone who already knows programming.

Preferably one-to-one.

Open Up Python IDE

Type

print("Hello, world!")

hello.py

Input

x = int(input("Enter a number: "))
print("Your number is", x)

If/Else Statements

x = int(input("Enter a number: "))

if x < 0:
   print("Your number is negative.")
elif x == 0:
   print("Your number is zero.")
else:
   print("Your number is positive.")

If/Else Statements

Edit code to check if an integer is divisible by 7.

Google it.

Challenge: Find a way to input an entire sentence.

 

Example: The quick brown fox jumps over the lazy dog.

Answer

s = input.readline()
print("The sentence is:", s)

Data Types

Python automatically detects the data types.

 

- Integer (3, 4, -1)

- Floating Point (2.31, 4.21, -2.12)

- Characters ('a', 'c', 'd')

- Strings ("Hi robotics sucks.")

- Booleans (True, False)

Loops

Example

# To print integers 1 to 1000.

x = 1
while x <= 1000:
   print(x)
   x += 1

# A "while" loop repeats until the condition specified is false.
# In this case, it loops until x is more than 1000, and outputs each
# intermediate integer, resulting in the sequence.

Final Activity

Pair Up.

Task

Make a number guessing game that does the following:

 

1. Generate a random integer from 1 to 1000.

2. Get the player to guess a number.

3. If the number is correct, tell the player he won and the number of tries he took.

4. If the number is wrong, inform the player if his guessed number is higher or lower than the correct number, then go back to step 2.

Answer

import random

answer = random.randint(1, 1000)
guess = 0
tries = 0
while guess != answer:
   guess = int(input("Guess a number:"))
   tries += 1
   if guess > answer:
      print("Your number is too high.")
   elif guess < answer:
      print("Your number is too low.")
print("You won! You took", tries, "tries.")

Thank you!

RIICC Y1 Introduction Slides

By Pang Wen Yuen

RIICC Y1 Introduction Slides

  • 679