Python for Everybody

Exercise 6.1, exercise 6.3, exercise 6.5.

assignment 6.5 python for everybody

assignment 6.5 python for everybody

Code examples.

  • answer assignment 6.5 python for everybody

More Related Answers

Answers matrix view full screen.

assignment 6.5 python for everybody

Documentation

Twitter Logo

Oops, You will need to install Grepper and log-in to perform this action.

Using this Course in Your Local LMS

You are welcome to use/reuse/remix/retain the materials from this site in your own courses. Nearly all the material in this web site is Copyright Creative Commons Attribution. These are links to downloadable content as well as links to other sources of this course material.

If your LMS supports IMS Learning Tools Interoperabilty® version 1.x, you can login, and request access to the tools on this site. Make sure you indicate whether you need an LTI 1.x key. You will be given instructions on how to use your credentials once you get your key.

Download course material as an IMS Common Cartridge® , to import into an LMS like Sakai, Moodle, Canvas, Desire2Learn, Blackboard, or similar. After loading the Cartridge, you will need an LTI key and secret to provision the LTI-based tools provided in that cartridge.

If your LMS supports Learning Tools Interoperability® Content-Item Message you can login and apply for an LTI 1.x key and secret and install this web site into your LMS as an App Store / Learning Object Repository that allows you to author you class in your LMS while selecting tools and content from this site one item at a time. You will be given instructions on how to set up the "app store" in your LMS when you receive your key and secret.

If your LMS supports neither Content Item, nor Common Cartridge, but does support LTI, you can hand-copy the links from this course material into your LMS one-by-one. We have a special low-style view of the lessons to make this hand-copying as easy as it can be.

Courses/web sites using this material

This web site uses the Tsugi software to both host the software-based autograders and provide this material so it can easily be integrated into a Learning Management System like Sakai , Moodle, Canvas, Desire2Learn, Blackboard or similar.

Links to course materials

  • YouTube Playlist
  • iTunes Video
  • Amazon Prime Video
  • iTunes Audio
  • Google Play Audio
  • Lecture Slides and Handouts
  • Sample Code ZIP ( Individual Files )
  • Free Textbook
  • All the course content and autograder software is available on Github under a Creative Commons or Apache 2.0 license.

If you are interested in translating the book or other online materials into another language, I have provided some instructions on how to translate this course in my GitHub repository. If you are starting a translation, please contact me so we can coordinate our activities.

Audio Archive

Here is an archive of the live lecture recordings from SI502 as taught on campus at the UM School of Information Fall 2015.

Copyright Creative Commons Attribution 3.0 - Charles R. Severance

Navigation Menu

Search code, repositories, users, issues, pull requests..., provide feedback.

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly.

To see all available qualifiers, see our documentation .

  • Notifications You must be signed in to change notification settings

Solutions to the exercises of the popular Python specialisation in Coursera offered by the University of Michigan

sormazi/PY4E

Folders and files.

NameName
47 Commits

Repository files navigation

Solutions to the exercises of the popular Python specialisation in Coursera offered by the University of Michigan and taught by Dr. Chuck. This repository contains the solutions of the assignments of all 5 courses in the specialisation: 1.Programming for Everybody (Getting started with Python) 2.Python Data Structures 3.Using Python to Access Web Data 4.Using Databases with Python 5.Capstone: Reviewing, Processing and Visualising Data with Python Solutions are not arranged according to course, but I have referenced the exercise numbers.

  • Python 99.4%

assignment 6.5 python for everybody

  • Table of Contents
  • Course Home
  • Assignments
  • Peer Instruction (Instructor)
  • Peer Instruction (Student)
  • Change Course
  • Instructor's Page
  • Progress Page
  • Edit Profile
  • Change Password
  • Scratch ActiveCode
  • Scratch Activecode
  • Instructors Guide
  • About Runestone
  • Report A Problem
  • Mixed-up code Questions
  • Write Code Questions
  • Peer Instruction: Iterations Multiple Choice Questions
  • 6.1 Updating variables
  • 6.2 The while statement
  • 6.3 Infinite loops
  • 6.4 Finishing iterations with continue
  • 6.5 Definite loops using for
  • 6.6 Loop patterns
  • 6.7 Debugging
  • 6.8 Glossary
  • 6.9 Multiple Choice Questions
  • 6.10 Mixed-up code Questions
  • 6.11 Write Code Questions
  • 6.12 Group Work - Loops (For, Range, While)
  • 6.1. Updating variables" data-toggle="tooltip">
  • 6.3. Infinite loops' data-toggle="tooltip" >

6.2. The while statement ¶

Computers are often used to automate repetitive tasks. Repeating identical or similar tasks without making errors is something that computers do well and people do poorly. Because iteration is so common, Python provides several language features to make it easier.

One form of iteration in Python is the while statement. Here is a simple program that counts down from five and then says “Blastoff!”.

Activity: CodeLens 6.2.1 (codelens511)

You can almost read the while statement as if it were English. It means, “While n is greater than 0, display the value of n and then reduce the value of n by 1. When you get to 0, exit the while statement and display the word Blastoff!

Q-2: Consider the code block below. What happens when you run this program?

  • The program has five iterations but does not print anything.
  • Incorrect! The program both prints things and has more than five iterations. Try again.
  • The loop will repeat forever and results in an infinite loop.
  • Correct! Because the loop is incrementing, rather than decrementing, n will always be greater than 0 and the loop will never end.
  • The program compiles and prints "1 2 3 4 5 Blastoff!" where each space is a new line.
  • Incorrect! The program will compile, but will not start with 1 and won't ever reach "Blastoff!". Try again.
  • The program compiles and prints "5 4 3 2 1 Blastoff!" where each space is a new line.
  • Incorrect! The program will compile, but it won't ever reach "Blastoff!". Try again.

More formally, here is the flow of execution for a while statement:

Evaluate the condition, yielding True or False .

If the condition is false, exit the while statement and continue execution at the next statement.

If the condition is true, execute the body and then go back to step 1.

This type of flow is called a loop because the third step loops back around to the top. We call each time we execute the body of the loop an iteration . For the above loop, we would say, “It had five iterations”, which means that the body of the loop was executed five times.

The body of the loop should change the value of one or more variables so that eventually the condition becomes false and the loop terminates. We call the variable that changes each time the loop executes and controls when the loop finishes the iteration variable . If there is no iteration variable, the loop will repeat forever, resulting in an infinite loop .

Q-4: Consider the code block below. What are the values of x and y when this while loop finishes executing?

  • x = 2; y = 5
  • Incorrect! These were the values of x and y at first, but they changed by the time the loop finished executing. Try again.
  • x = 5; y = 2
  • Incorrect! The while loop will finish executing before x and y reach these values. Try again.
  • x = 4; y = 3
  • Correct! The loop will terminate at x = 4 and y = 3 because at this point, x is not less than y.
  • x = 4; y = 2
  • Incorrect! The way the loop modifies x and y, it is impossible for y to be 2 while x is 4. Try again.

IMAGES

  1. Programming for Everybody (Getting Started with Python)

    assignment 6.5 python for everybody

  2. GitHub

    assignment 6.5 python for everybody

  3. 【Python for Everybody(Python Data Structures)】Week 1

    assignment 6.5 python for everybody

  4. [PDF] Download Python for Everybody by Charles Severance Book pdf

    assignment 6.5 python for everybody

  5. Coursera: Python For Everybody Complete Course Assignments Solution |Python For Everybody Assignment

    assignment 6.5 python for everybody

  6. Python for everybody Week 6 Quiz Answer

    assignment 6.5 python for everybody

VIDEO

  1. Python for Everybody Full University Python Course 1

  2. Assignment Operator in python|#python #shorts #assignmentoperators #python3 #pythonprogramming

  3. PROGRAMMING IN PYTHON || WEEK-2 || ASSIGNMENT

  4. Print the Score

  5. Python Programming Important Questions for All 5 Units for AKTU exam BCC302/402 & Important Programs

  6. Grand Assignment

COMMENTS

  1. python-for-everybody/wk6

    Cannot retrieve latest commit at this time. #6.5 Write code using find () and string slicing (see section 6.10) to extract the number at the end of the line below. #Convert the extracted value to a floating point number and print it out. text = "X-DSPAM-Confidence: 0.8475" start = text.find ('0') result =float (text [start : ]) print (result ...

  2. Python-for-everybody/Chapter 6

    Saved searches Use saved searches to filter your results more quickly

  3. sersavn/coursera-python-for-everybody-specialization

    Current repository contains all assignments, notes, quizzes and course materials from the "Python for Everybody Specialization" provided by Coursera and University of Michigan. - sersavn/coursera-python-for-everybody-specialization

  4. Python For Everybody Assignment 6.5

    Code link:https://drive.google.com/file/d/1_CFCEsdnlxaOrYoTm7AzSVQ2gNyAswQ5/view?usp=sharingCoursera: Python For Everybody Assignment 6.5 program solution | ...

  5. Python for Everybody Answers

    The video is about the solution of the mentioned assignment of the python course named 'PYTHON FOR EVERYBODY' on coursera by Dr. Chuck

  6. 6.5: Strings are immutable

    6.5: Strings are immutable. It is tempting to use the operator on the left side of an assignment, with the intention of changing a character in a string. For example: >>> greeting = 'Hello, world!'. The "object" in this case is the string and the "item" is the character you tried to assign. For now, an object is the same thing as a value, but ...

  7. Coursera Python for everybody Assignments 6.1 & 6.5

    This is the second part of video solutions of course Python for everybody on Coursera.Subscribe to my channel to get frequent updates.*For Donations/Payments...

  8. Python for Everybody

    Python for Everybody - Interactive¶ Assignments¶ Assignments; Table of Contents ...

  9. Coursera-PY4E-Python-Data-Structures/Assignment-6.5 at master

    Contribute to riya2905/Coursera-PY4E-Python-Data-Structures development by creating an account on GitHub.

  10. 6.5. Definite loops using for

    5. Activity: 6.5.3 An example of using a for loop to iterate through a list. (itr-section5_1) In Python terms, the variable friends is a list (We will examine lists in more detail in a later chapter) of three strings. The for loop goes through the list and executes the body once for each of the three strings in the list resulting in this output:

  11. PY4E

    Python for Everybody. This web site is building a set of free materials, lectures, book and assignments to help students learn how to program in Python. You can take this course and receive a certificate at: Coursera: Python for Everybody Specialization; edX: Python for Everybody; FreeCodeCamp

  12. 6.6. Loop patterns

    6.6. Loop patterns ¶. Often we use a for or while loop to go through a list of items or the contents of a file and we are looking for something such as the largest or smallest value of the data we scan through. We will use a list of numbers to demonstrate the concepts and construction of these loop patterns. 6.6.1. Counting and summing loops ¶.

  13. Projects

    Exercise 6.3""" Exercise 6.3: Encapsulate this code in a function named count, and generalize it so that it accepts the string and the letter as arguments. Python for Everybody: Exploring Data Using Python 3 by Charles R. Severance Solution by Jamison Lahman, May 31, 2017 """ def count (word, letter): """" Counts the number of times a given letter appears in a word Input: word -- the word in ...

  14. jmelahman/python-for-everybody-solutions

    Solutions to Python for Everybody: Exploring Data using Python 3 by Charles Severance - jmelahman/python-for-everybody-solutions

  15. assignment 6.5 python for everybody

    assignment 6.5 python for everybody. Add Answer . Comfortable Cod answered on August 27, 2020 Popularity 8/10 Helpfulness 2/10 Contents ; answer assignment 6.5 python for everybody; More Related Answers . assignment 6.5 python for everybody Comment . 0. Tip Comfortable Cod 1 GREPCC ...

  16. Python Data Structures Assignment 6.5 Solution [Coursera ...

    Python Data Structures Assignment 6.5 Solution [Coursera] | Assignment 6.5 Python Data StructuresCoursera: Programming For Everybody Assignment 6.5 program s...

  17. PY4E

    Download course material as an IMS Common Cartridge®, to import into an LMS like Sakai, Moodle, Canvas, Desire2Learn, Blackboard, or similar. After loading the Cartridge, you will need an LTI key and secret to provision the LTI-based tools provided in that cartridge. If your LMS supports Learning Tools Interoperability® Content-Item Message ...

  18. GitHub

    The answers are entirely created by me. They are not the same as the suggested ones. However, they produce the same results and are roughly similar. Moreover, there are inline notes to help you to understand each step. I created python files on the go when I watched the lectures to document every ...

  19. Solutions to the exercises of the popular Python specialisation in

    Solutions to the exercises of the popular Python specialisation in Coursera offered by the University of Michigan and taught by Dr. Chuck. This repository contains the solutions of the assignments of all 5 courses in the specialisation: 1.Programming for Everybody (Getting started with Python) 2.Python Data Structures 3.Using Python to Access Web Data 4.Using Databases with Python 5.Capstone ...

  20. 6.2. The while statement

    6.2. The while statement ¶. Computers are often used to automate repetitive tasks. Repeating identical or similar tasks without making errors is something that computers do well and people do poorly. Because iteration is so common, Python provides several language features to make it easier. One form of iteration in Python is the while statement.