LESSON 3B. FOCUS: FOR LOOPS, NESTED LOOPS, TASKS AND CHALLENGES.
Introduction to, with examples, For loops. Challenges and tasks included with solutions (predict the output). Compare ‘while’ and ‘for’ loops. Use the break statement and explore how it works in different scenarios. Learn about Nested Loops. Learn about the need for initialisation (set starting value). Create your own for loops. Create the beginnings of an arithmetic quiz using a random function and for loops. Big ideas discussion: Is the universe digital. A program? Introducing Gottfried Leibniz and Konrad Zuse. Includes a suggested videos, ‘Big ideas’ discussion, and HW/research projects section.
LESSON 3A. INTRODUCTION TO ITERATION: LOOPS, TRACE TABLES, WHILE LOOPS
Introduction to Iteration and loops. The theory behind loops and how they work. Create and adapt programs using loops. Intro to the random number generator. Learn about trace tabling (white box testing). Example of a trace table and dry run. Wonders of the Fibonacci sequence. Examples of Iteration in game design. Focus on While loops. Challenges, tasks (with solutions), suggested videos, big ideas discussion and research and HW included. Introducing Ada Lovelace and Charles Babbage.
LESSON 2. CONDITIONAL LOGIC, IF ELSE STATEMENTS, SELECTION, DEBUGGING
Introduction to, with examples, conditional logic and the use of IF and ELSE statements. Look at SELECTION in game design. Learn about Debugging and Error Checking. Analyse the use of a flow chart and how to design before implementation. Discuss: Video gaming addiction! Create a password checker and a username and password (login) app. Learn about the use of ELIF. Learn about Boolean variables and their use. Learn about Multiple comparisons using and/or. Includes a suggested videos, ‘Big ideas’ discussion, and HW/research projects section. Discussion on Artificial Intelligence and Robotics.
Introduction to Python 01-08-2023.pon by everyone else. . Hence, they must be...DRVaibhavmeshram1
Python
Language
is uesd in engineeringStory adapted from Stephen Covey (2004) “The Seven Habits of Highly Effective People” Simon & Schuster).
“Management is doing things right, leadership is doing the right things”
(Warren Bennis and Peter Drucker)
Story adapted from Stephen Covey (2004) “The Seven Habits of Highly Effective People” Simon & Schuster).
“Management is doing things right, leadership is doing the right things”
(Warren Bennis and Peter Drucker)
Story adapted from Stephen Covey (2004) “The Seven Habits of Highly Effective People” Simon & Schuster).
“Management is doing things right, leadership is doing the right things”
(Warren Bennis and Peter Drucker)
The Sponsor:
Champion and advocates for the change at their level in the organization.
A Sponsor is the person who won’t let the change initiative die from lack of attention, and is willing to use their political capital to make the change happen
The Role model:
Behaviors and attitudes demonstrated by them are looked upon by everyone else. . Hence, they must be willing to go first.
Employees watch leaders for consistency between words and actions to see if they should believe the change is really going to happen.
The decision maker:
Leaders usually control resources such as people, budgets, and equipment, and thus have the authority to make decisions (as per their span of control) that affect the initiative.
During change, leaders must leverage their decision-making authority and choose the options that will support the initiative.
The Decision-Maker is decisive and sets priorities that support change.
The Sponsor:
Champion and advocates for the change at their level in the organization.
A Sponsor is the person who won’t let the change initiative die from lack of attention, and is willing to use their political capital to make the change happen
The Role model:
Behaviors and attitudes demonstrated by them are looked upon by everyone else. . Hence, they must be willing to go first.
Employees watch leaders for consistency between words and actions to see if they should believe the change is really going to happen.
The decision maker:
Leaders usually control resources such as people, budgets, and equipment, and thus have the authority to make decisions (as per their span of control) that affect the initiative.
During change, leaders must leverage their decision-making authority and choose the options that will support the initiative.
The Decision-Maker is decisive and sets priorities that support change.
The Sponsor:
Champion and advocates for the change at their level in the organization.
A Sponsor is the person who won’t let the change initiative die from lack of attention, and is willing to use their political capital to make the change happen
The Role model:
Behaviors and attitudes demonstrated by them are looked upon by everyone else. . Hence, they must be willing to go first.
Employees watch leaders for consistency between words and actions to see if they s
Helpmeinhomework Experts provides the most trusted and reliable online Programming assignment help . Programming is one of the most widely taught subjects across the universities. The complexity of subjects make students seek for quality and affordable online guidance. We at helpmeinhomework.com Experts cater to such needs of the students. Our programming experts provide assignment help to students across UK, USA and Australia for multiple programming languages i.e. Java, Python, HTML, PHP, Assembly language, C ,Linux ,Unix etc.
LESSON 3B. FOCUS: FOR LOOPS, NESTED LOOPS, TASKS AND CHALLENGES.
Introduction to, with examples, For loops. Challenges and tasks included with solutions (predict the output). Compare ‘while’ and ‘for’ loops. Use the break statement and explore how it works in different scenarios. Learn about Nested Loops. Learn about the need for initialisation (set starting value). Create your own for loops. Create the beginnings of an arithmetic quiz using a random function and for loops. Big ideas discussion: Is the universe digital. A program? Introducing Gottfried Leibniz and Konrad Zuse. Includes a suggested videos, ‘Big ideas’ discussion, and HW/research projects section.
LESSON 3A. INTRODUCTION TO ITERATION: LOOPS, TRACE TABLES, WHILE LOOPS
Introduction to Iteration and loops. The theory behind loops and how they work. Create and adapt programs using loops. Intro to the random number generator. Learn about trace tabling (white box testing). Example of a trace table and dry run. Wonders of the Fibonacci sequence. Examples of Iteration in game design. Focus on While loops. Challenges, tasks (with solutions), suggested videos, big ideas discussion and research and HW included. Introducing Ada Lovelace and Charles Babbage.
LESSON 2. CONDITIONAL LOGIC, IF ELSE STATEMENTS, SELECTION, DEBUGGING
Introduction to, with examples, conditional logic and the use of IF and ELSE statements. Look at SELECTION in game design. Learn about Debugging and Error Checking. Analyse the use of a flow chart and how to design before implementation. Discuss: Video gaming addiction! Create a password checker and a username and password (login) app. Learn about the use of ELIF. Learn about Boolean variables and their use. Learn about Multiple comparisons using and/or. Includes a suggested videos, ‘Big ideas’ discussion, and HW/research projects section. Discussion on Artificial Intelligence and Robotics.
Introduction to Python 01-08-2023.pon by everyone else. . Hence, they must be...DRVaibhavmeshram1
Python
Language
is uesd in engineeringStory adapted from Stephen Covey (2004) “The Seven Habits of Highly Effective People” Simon & Schuster).
“Management is doing things right, leadership is doing the right things”
(Warren Bennis and Peter Drucker)
Story adapted from Stephen Covey (2004) “The Seven Habits of Highly Effective People” Simon & Schuster).
“Management is doing things right, leadership is doing the right things”
(Warren Bennis and Peter Drucker)
Story adapted from Stephen Covey (2004) “The Seven Habits of Highly Effective People” Simon & Schuster).
“Management is doing things right, leadership is doing the right things”
(Warren Bennis and Peter Drucker)
The Sponsor:
Champion and advocates for the change at their level in the organization.
A Sponsor is the person who won’t let the change initiative die from lack of attention, and is willing to use their political capital to make the change happen
The Role model:
Behaviors and attitudes demonstrated by them are looked upon by everyone else. . Hence, they must be willing to go first.
Employees watch leaders for consistency between words and actions to see if they should believe the change is really going to happen.
The decision maker:
Leaders usually control resources such as people, budgets, and equipment, and thus have the authority to make decisions (as per their span of control) that affect the initiative.
During change, leaders must leverage their decision-making authority and choose the options that will support the initiative.
The Decision-Maker is decisive and sets priorities that support change.
The Sponsor:
Champion and advocates for the change at their level in the organization.
A Sponsor is the person who won’t let the change initiative die from lack of attention, and is willing to use their political capital to make the change happen
The Role model:
Behaviors and attitudes demonstrated by them are looked upon by everyone else. . Hence, they must be willing to go first.
Employees watch leaders for consistency between words and actions to see if they should believe the change is really going to happen.
The decision maker:
Leaders usually control resources such as people, budgets, and equipment, and thus have the authority to make decisions (as per their span of control) that affect the initiative.
During change, leaders must leverage their decision-making authority and choose the options that will support the initiative.
The Decision-Maker is decisive and sets priorities that support change.
The Sponsor:
Champion and advocates for the change at their level in the organization.
A Sponsor is the person who won’t let the change initiative die from lack of attention, and is willing to use their political capital to make the change happen
The Role model:
Behaviors and attitudes demonstrated by them are looked upon by everyone else. . Hence, they must be willing to go first.
Employees watch leaders for consistency between words and actions to see if they s
Helpmeinhomework Experts provides the most trusted and reliable online Programming assignment help . Programming is one of the most widely taught subjects across the universities. The complexity of subjects make students seek for quality and affordable online guidance. We at helpmeinhomework.com Experts cater to such needs of the students. Our programming experts provide assignment help to students across UK, USA and Australia for multiple programming languages i.e. Java, Python, HTML, PHP, Assembly language, C ,Linux ,Unix etc.
This is the slide presenting about how to use Python programming language to create an desktop application at a very basic level.
Target: Non-IT background people who interested in programming.
CMIS 102 Hands-On Lab
// Week 4
Overview:
This hands-on lab allows you to follow and experiment with the critical steps of developing a program including the program description, analysis, test plan, design (using both flow chart and pseudocode visualization), and implementation with C code. The example provided uses sequential, selection and repetition statements.
Program Description:
This program will calculate the sum of 10 integers. The program will ask the user to 10 integers. If the sum of the numbers is greater than 1000, a message is printed stating the sum is over 1000. The design step will include both pseudocode and flow chart visualization.
Analysis:
I will use sequential, selection and repetition programming statements.
I will define three integer numbers: count, value, sum. Count will store how many times values are entered to make sure we don’t exceed 10 values. Value will store the input integer and sum will store the running sum.
The sum will be calculated by this formula:
sum = sum + value
For example, if the first value entered was 4 and second was 10:
sum = sum + value = 0 + 4
sum = 4 + 10 = 14
Values and sum can be input and calculated within a repetition loop:
while count <10
Input value
sum = sum + value
End while
The additional selection statement will be of this form:
If sum > 1000 then
print "Sum is over 1000"
End If
Test Plan:
To verify this program is working properly the input values could be used for testing:
Test Case
Input
Expected Output
1
value=1
value=1
value=1
value=0
value=1
value=2
value=0
value=1
value=3
value=2
Sum = 12
2
value=100
value=100
value=100
value=100
value=100
value=200
value=200
value=200
value=200
value=200
Sum = 1200
Sum is over 1000.
3
value=-100
value=-100
value=-200
value=0
value=200
value=100
value=0
value=200
value=-300
value=-200
Sum = -400
Pseudocode:
// This program will calculate the sum of 10 integers.
// Declare variables
Declare count, value, sum as Integer
//Initialize Counter, Sum to 0
Set count=0
Set sum = 0
// Loop through 10 integers
While count < 10
Print “Enter an Integer”
Input value
sum = sum + value
count=count+1
End While
// Print results and messages
Print “Sum is “ + sum
If (sum > 1000)
Printf “Sum is over 1000”
End if
Flow Chart:
C Code
The following is the C Code that will compile in execute in the online compilers.
// C code
// This program will calculate the sum of 10 integers.
// Developer: Faculty CMIS102
// Date: Jan 31, 2014
#include <stdio.h>
int main ()
{
/* variable definition: */
int count, value, sum;
/* Initialize count and sum */
count = 0;
sum = 0;
// Loop through to input values
while (count < 10)
{
printf("Enter an Integer\n");
scanf("%d", &value);
sum = sum + value;
count = count + 1;
}
printf("Sum is %d\n " , sum );
if (sum >1000)
printf("Sum is over 1000\n");
return 0;
}
Setting up the code and the input parameters in ideone.com:
Note the input integer.
Python programming language provides the following types of loops to handle looping requirements:
1. While
2. Do While
3. For loop
Python provides three ways for executing the loops. While all the ways provide similar basic functionality, they differ in their syntax and condition-checking time.
إذا كُنت من هواة البرمجة ولم تُحلّق في هذا العالم بعد فالطريق ما زال مفتوحًا أمامك، فالفضاء موجود أمامك لتختار أحد المسارات وتسلكها فورًا.
اختيار المسار بحد ذاته هو الحاجز الذي نقف عنده في الغالب، بل ويستغرق وقتًا أطول من وقت التعلّم والمُمارسة، لكن ليس هُناك أجمل من الاستفادة من التقنيات الموجودة بين أيدينا حاليًا لتطوير أدوات نستطيع الاستفادة منها.
لمزيد من المعلومات اشتركوا في قائمتنا البريدية:
https://www.apptrainers.com/
The French Revolution, which began in 1789, was a period of radical social and political upheaval in France. It marked the decline of absolute monarchies, the rise of secular and democratic republics, and the eventual rise of Napoleon Bonaparte. This revolutionary period is crucial in understanding the transition from feudalism to modernity in Europe.
For more information, visit-www.vavaclasses.com
Honest Reviews of Tim Han LMA Course Program.pptxtimhan337
Personal development courses are widely available today, with each one promising life-changing outcomes. Tim Han’s Life Mastery Achievers (LMA) Course has drawn a lot of interest. In addition to offering my frank assessment of Success Insider’s LMA Course, this piece examines the course’s effects via a variety of Tim Han LMA course reviews and Success Insider comments.
This is the slide presenting about how to use Python programming language to create an desktop application at a very basic level.
Target: Non-IT background people who interested in programming.
CMIS 102 Hands-On Lab
// Week 4
Overview:
This hands-on lab allows you to follow and experiment with the critical steps of developing a program including the program description, analysis, test plan, design (using both flow chart and pseudocode visualization), and implementation with C code. The example provided uses sequential, selection and repetition statements.
Program Description:
This program will calculate the sum of 10 integers. The program will ask the user to 10 integers. If the sum of the numbers is greater than 1000, a message is printed stating the sum is over 1000. The design step will include both pseudocode and flow chart visualization.
Analysis:
I will use sequential, selection and repetition programming statements.
I will define three integer numbers: count, value, sum. Count will store how many times values are entered to make sure we don’t exceed 10 values. Value will store the input integer and sum will store the running sum.
The sum will be calculated by this formula:
sum = sum + value
For example, if the first value entered was 4 and second was 10:
sum = sum + value = 0 + 4
sum = 4 + 10 = 14
Values and sum can be input and calculated within a repetition loop:
while count <10
Input value
sum = sum + value
End while
The additional selection statement will be of this form:
If sum > 1000 then
print "Sum is over 1000"
End If
Test Plan:
To verify this program is working properly the input values could be used for testing:
Test Case
Input
Expected Output
1
value=1
value=1
value=1
value=0
value=1
value=2
value=0
value=1
value=3
value=2
Sum = 12
2
value=100
value=100
value=100
value=100
value=100
value=200
value=200
value=200
value=200
value=200
Sum = 1200
Sum is over 1000.
3
value=-100
value=-100
value=-200
value=0
value=200
value=100
value=0
value=200
value=-300
value=-200
Sum = -400
Pseudocode:
// This program will calculate the sum of 10 integers.
// Declare variables
Declare count, value, sum as Integer
//Initialize Counter, Sum to 0
Set count=0
Set sum = 0
// Loop through 10 integers
While count < 10
Print “Enter an Integer”
Input value
sum = sum + value
count=count+1
End While
// Print results and messages
Print “Sum is “ + sum
If (sum > 1000)
Printf “Sum is over 1000”
End if
Flow Chart:
C Code
The following is the C Code that will compile in execute in the online compilers.
// C code
// This program will calculate the sum of 10 integers.
// Developer: Faculty CMIS102
// Date: Jan 31, 2014
#include <stdio.h>
int main ()
{
/* variable definition: */
int count, value, sum;
/* Initialize count and sum */
count = 0;
sum = 0;
// Loop through to input values
while (count < 10)
{
printf("Enter an Integer\n");
scanf("%d", &value);
sum = sum + value;
count = count + 1;
}
printf("Sum is %d\n " , sum );
if (sum >1000)
printf("Sum is over 1000\n");
return 0;
}
Setting up the code and the input parameters in ideone.com:
Note the input integer.
Python programming language provides the following types of loops to handle looping requirements:
1. While
2. Do While
3. For loop
Python provides three ways for executing the loops. While all the ways provide similar basic functionality, they differ in their syntax and condition-checking time.
إذا كُنت من هواة البرمجة ولم تُحلّق في هذا العالم بعد فالطريق ما زال مفتوحًا أمامك، فالفضاء موجود أمامك لتختار أحد المسارات وتسلكها فورًا.
اختيار المسار بحد ذاته هو الحاجز الذي نقف عنده في الغالب، بل ويستغرق وقتًا أطول من وقت التعلّم والمُمارسة، لكن ليس هُناك أجمل من الاستفادة من التقنيات الموجودة بين أيدينا حاليًا لتطوير أدوات نستطيع الاستفادة منها.
لمزيد من المعلومات اشتركوا في قائمتنا البريدية:
https://www.apptrainers.com/
The French Revolution, which began in 1789, was a period of radical social and political upheaval in France. It marked the decline of absolute monarchies, the rise of secular and democratic republics, and the eventual rise of Napoleon Bonaparte. This revolutionary period is crucial in understanding the transition from feudalism to modernity in Europe.
For more information, visit-www.vavaclasses.com
Honest Reviews of Tim Han LMA Course Program.pptxtimhan337
Personal development courses are widely available today, with each one promising life-changing outcomes. Tim Han’s Life Mastery Achievers (LMA) Course has drawn a lot of interest. In addition to offering my frank assessment of Success Insider’s LMA Course, this piece examines the course’s effects via a variety of Tim Han LMA course reviews and Success Insider comments.
Francesca Gottschalk - How can education support child empowerment.pptxEduSkills OECD
Francesca Gottschalk from the OECD’s Centre for Educational Research and Innovation presents at the Ask an Expert Webinar: How can education support child empowerment?
Introduction to AI for Nonprofits with Tapp NetworkTechSoup
Dive into the world of AI! Experts Jon Hill and Tareq Monaur will guide you through AI's role in enhancing nonprofit websites and basic marketing strategies, making it easy to understand and apply.
Biological screening of herbal drugs: Introduction and Need for
Phyto-Pharmacological Screening, New Strategies for evaluating
Natural Products, In vitro evaluation techniques for Antioxidants, Antimicrobial and Anticancer drugs. In vivo evaluation techniques
for Anti-inflammatory, Antiulcer, Anticancer, Wound healing, Antidiabetic, Hepatoprotective, Cardio protective, Diuretics and
Antifertility, Toxicity studies as per OECD guidelines
Instructions for Submissions thorugh G- Classroom.pptxJheel Barad
This presentation provides a briefing on how to upload submissions and documents in Google Classroom. It was prepared as part of an orientation for new Sainik School in-service teacher trainees. As a training officer, my goal is to ensure that you are comfortable and proficient with this essential tool for managing assignments and fostering student engagement.
Acetabularia Information For Class 9 .docxvaibhavrinwa19
Acetabularia acetabulum is a single-celled green alga that in its vegetative state is morphologically differentiated into a basal rhizoid and an axially elongated stalk, which bears whorls of branching hairs. The single diploid nucleus resides in the rhizoid.
Unit 8 - Information and Communication Technology (Paper I).pdfThiyagu K
This slides describes the basic concepts of ICT, basics of Email, Emerging Technology and Digital Initiatives in Education. This presentations aligns with the UGC Paper I syllabus.
A Strategic Approach: GenAI in EducationPeter Windle
Artificial Intelligence (AI) technologies such as Generative AI, Image Generators and Large Language Models have had a dramatic impact on teaching, learning and assessment over the past 18 months. The most immediate threat AI posed was to Academic Integrity with Higher Education Institutes (HEIs) focusing their efforts on combating the use of GenAI in assessment. Guidelines were developed for staff and students, policies put in place too. Innovative educators have forged paths in the use of Generative AI for teaching, learning and assessments leading to pockets of transformation springing up across HEIs, often with little or no top-down guidance, support or direction.
This Gasta posits a strategic approach to integrating AI into HEIs to prepare staff, students and the curriculum for an evolving world and workplace. We will highlight the advantages of working with these technologies beyond the realm of teaching, learning and assessment by considering prompt engineering skills, industry impact, curriculum changes, and the need for staff upskilling. In contrast, not engaging strategically with Generative AI poses risks, including falling behind peers, missed opportunities and failing to ensure our graduates remain employable. The rapid evolution of AI technologies necessitates a proactive and strategic approach if we are to remain relevant.
3. In this lesson you will …
11.1.2.4 write program code using a For loop
11.1.2.5 define a range of values for a loop
11.1.2.6 debug a program
11.4.3.2 solve applied problems from various
subject areas
4. Did you know?
Guido van Rossum, the guy on the right, created python!
He is a Dutch computer programmer and completed his
degree in the university of Amsterdam
He was employed by Google from 2005 until December
2012, where much of his time was spent developing the
Python language. In 2013, Van Rossum started working
for Dropbox.
Python is intended to be a highly readable language. It
has a relatively uncluttered visual layout, frequently using
English keywords where other languages use punctuation.
Guido van Rossum, the creator of Python
An important goal of the Python developers is making Python fun to use. This is
reflected in the origin of the name which comes from Monty Python
5. The difference between ‘While’ and ‘For’
For loops are traditionally used when you have a piece of code which you want
to repeat n number of times. As an alternative, there is the WhileLoop,
however, while is used when a condition is to be met, or if you want a piece of
code to repeat forever, for example -
For loops are used when the number of iterations are known before hand.
The name for-loop comes
from the English word
“for”, which is used as the
keyword in most
languages. The term in
English dates to ALGOL 58
6. For Loops and game design …
Take, for example, the game ‘Super Mario’. For
loops can be used to create a timed interval
recall loop for each animation. See if you can
spot the “for loop” in the code below.
It would be hard to come across a programmed game that has not utilised a
for loop of some kind in its code.
7. The anatomy of a For Loop
for <variable> in <sequence>:
<statements>
else:
<statements>
The For Loop can step through the items in any ordered
sequence list, i.e. string, lists, tuples, the keys of dictionaries
and other iterables. It starts with the keyword "for" followed
by an arbitrary variable name. This will hold the values of the
following sequence object, which is stepped through.
Generally, the syntax looks like this:
8. Task 1: Predict the output (using For Loops)
Predict the output, then code it yourself to see if you were right!
Both of these do the same thing. Note: 0 is the starting point.
Look out for FORMAT SPECIFIERS: The %d specifier refers specifically to a decimal (base 10) integer.
The %s specifier refers to a Python string.
10. Nested Loops
And now for a Nested Loop. This will break each word into its constituent letters
and print them out.
A Nested loop is basically a loop within a loop. You can have a for loop inside a
while loop or vice versa. Let’s start with something simple. Use a for loop to print
out the items in a list.
OUTPUT
OUTPUT
11. Challenge 1: 3 and 4 times table up to 10
This bit of code produces the times tables for the numbers 1 and 2 (and only up
to 5). Can you change it to produce the following? (3 and 4 times table up to 10)
1. Type in the code below (nested loop used)
2. Run it to see what it does
3. Now try and change the values in the
program to get it to do what is required.
4. Once done, play around with these values
and get it to produce more timestables!
You could go all the way up to 100!
Desired output
12. Solution1: 3 and 4 times table up to 10
The key is to understand the way the “range” works in Python. Change the
numbers to the following and it should work! Now you can experiment with
doing more!
Output
Change the above to ….
13. The ‘Break’ statement – how it works!
found = False # initial assumption
for value in values_to_check() :
if is_what_im_looking_for(value) :
found = True
break
#end if
#end for
# ... found is True on success, False on
failure
Having no way out of a situation is never a good thing! In python programming,
you can use the ‘Break’ statement to exit a loop – say for instance the conditions
of the loop aren’t met.
14. Note how ‘break’ provides an early exit
Having no way out of a situation is never a good thing! In python programming, you can use
the ‘Break’ statement to exit a loop – say for instance the conditions of the loop aren’t met.
OUTPUT
Note only 1,2,3,4 are printed from the range and once x = 5, the loop is exited!
OUTPUT?
Nothing! This is because the
loop finds ‘1’ and breaks
before it can do anything!
???????
15. Challenge 2: Extend the code and get
someone to try out your program!
1. Copy the code on the right
and analyse how it works
(notice use of user input, lists
and for loops)
2. Extend the program to:
a) Ask the user how many more
holidays they are planning for
the coming year(s)
b) Allow them to enter the
places they would like to visit
c) Append these new values to
the list.
d) Print the new list.
e) If they enter a number over
10 or zero, exit the loop.
print ("**********Hello, welcome to the program***********")
print ("This program will ask you to enter the names of places you've been
to")
print ("Before we get started, please enter the number of places you want
to enter")
number = int(input("How many holidays have you had this year?: "))
print ("Thank you!")
print ("We'll now ask you to enter all the places you've traveled to: ")
places_traveled = [] #Empty list created to hold entered values
for i in range(number): #range(number) used because we want to limit
number of inputs to user choice
places = input("Enter Place:")
places_traveled.append(places)
print (("Here's a list of places you've been to: n"), places_traveled)
16. Challenge 3:The beginnings of an Arithmetic
Quiz Program. Can you extend it?
1. Copy the code on the right
and analyse how it works
(notice use of random function
and for loops)
2. Extend the program to:
a) Create more questions (what
would you need to change to
do this?)
b) Add a division operator to the
mix so that the questions also
extend to division.
c) Gifted and Talented: What
else could you add to make
this program more interesting?
How about a score variable
that increments each time an
answer is correct?
#-------------------------------------------------------------------------------
# Name: Maths Quiz
# Purpose: Tutorial
# Author: teachingcomputing.com
# Created: 23/02/2016
# Copyright: (c) teachingcomputing.com 2016
#-------------------------------------------------------------------------------
import random
#identifying the variables we will be using
score=0
answer=0
operators=("x", "+", "-")
#Randomly generate the numbers and operators we will be using in this
17. Discussion: Is the universe Binary?
https://en.wikipedia.org/wiki/Digital_physics
You may find Wikipedia’s listing on digital universe possibilities an interesting read
In physics and
cosmology, digital
physics is a collection of
theoretical perspectives
based on the premise
that the universe is, at
heart, describable by
information and is
therefore computable.
Some scientists say that the universe may in fact be a computer program.
18. Useful Videos to watch on covered topics
https://youtu.be/atMuFCpxnUQ https://youtu.be/9LgyKiq_hU0
What is the nature of the universe we live in? Recommended video on Python For Loops
Teachers tip: To make this activity less dry, try and deliver it as a test/challenge – (who can do it first?). Get students to type the code in themselves and have the coded solutions ready. As an extension, students can try to write their own for loop based on the ones they have already seen.
*Teachers can delete this slide if using it to test students in a lesson.