User Tools

Site Tools


2023f:gao_yi_yi_scitech

高一義 SciTech

This is a Python Programming course. You can use these places to write Python:

Nov 10

  • TBD: To discuss in teacher's meeting.

Nov 3

  • TBD: To discuss in teacher's meeting.

October 27

  • TBD: To discuss in teacher's meeting.

October 20

  • Today's lesson: Functions.
  • The class was moved or changed again, so I was unable to teach it.

October 13

  • The class was moved to 8th period, so I was not able to teach today.
  • However, I prepared a detailed lesson plan for the teacher here: Third Lesson

October 6

There was a test today, so, no class.

September 15

  • In this class we will learn about random numbers and IF-THEN.
  • n = random.randint(from,to)
  • if n == 1: print(“heads”);

Example 1

program-2a.py


import random

n = random.randint(1,2)

print(n)
 

In this program we get a random number. Now, we need to know how to deal with it.

Example 2

program-2b.py


import random

n = random.randint(1,2)

if n == 1:
    print("Heads!")
else:
    print("Tails!")
 

Homework

Here is an example program to help you get started:

program-2c.py


import random

n = random.randint(1,3)

if n == 1:
    print("scissor!")
elif n == 2:
    print("paper!")
else:
    print("stone!)
 

Ok, so what is today's homework?

Todays homework is to write a program that rolls dice. The output must be one of the following six possibilities:

 *

or

*
  
  *

or

*
 *
  *

or

* *
  
* *

or

* *
 *
* *

or

* *
* *
* *

Good luck on today's homework! The answer will be posted next week.

September 8

  • In this class we learned the following commands:
    • print(“hello”)
    • a = input(“what is your name?”)

Today's homework is to write a program that asks for first name and last name and then prints it. Here is an example answer:

sep8.py


a = input("What is your first name? ")
c = input("What is your last name? ")

print ("Hello " + a + " " + c + "!")
 

There are many ways to write the print statement. As long as it is relatively simple and produces the same output it is fine. Another example could be <Code:Python>print(“Hello”, a, c, end=“”); print(“!”) or some method using c+“!”''.

2023f/gao_yi_yi_scitech.txt · Last modified: by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki