If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

To log in and use all the features of Khan Academy, please enable JavaScript in your browser.

Intro to computer science - Python

New videos and exercises are available, unit 1: computational thinking with variables, unit 2: designing algorithms with conditionals, unit 3: simulating phenomena with loops, unit 4: playing games with functions, unit 5: automating tasks with lists, unit 6: analyzing data with dictionaries.

Assignment 7: Calendar

Browse Course Material

Course info, instructors.

  • Dr. Ana Bell
  • Prof. Eric Grimson
  • Prof. John Guttag

Departments

  • Electrical Engineering and Computer Science

As Taught In

  • Algorithms and Data Structures
  • Programming Languages

Learning Resource Types

Introduction to computer science and programming in python, course description.

A black backlit keyboard.

You are leaving MIT OpenCourseWare

Interested in a verified certificate or a professional certificate ?

An introduction to programming using a language called Python. Learn how to read and write code as well as how to test and “debug” it. Designed for students with or without prior programming experience who’d like to learn Python specifically. Learn about functions, arguments, and return values (oh my!); variables and types; conditionals and Boolean expressions; and loops. Learn how to handle exceptions, find and fix bugs, and write unit tests; use third-party libraries; validate and extract data with regular expressions; model real-world entities with classes, objects, methods, and properties; and read and write files. Hands-on opportunities for lots of practice. Exercises inspired by real-world programming problems. No software required except for a web browser, or you can write code on your own PC or Mac.

Whereas CS50x itself focuses on computer science more generally as well as programming with C, Python, SQL, and JavaScript, this course, aka CS50P, is entirely focused on programming with Python. You can take CS50P before CS50x, during CS50x, or after CS50x. But for an introduction to computer science itself, you should still take CS50x!

How to Take this Course

Even if you are not a student at Harvard, you are welcome to “take” this course for free via this OpenCourseWare by working your way through the course’s ten weeks of material. If you’d like to submit the course’s problem sets and final project for feedback, be sure to create an edX account , if you haven’t already. Ask questions along the way via any of the course’s communities !

  • If interested in a verified certificate from edX , enroll at cs50.edx.org/python instead.
  • If interested in a professional certificate from edX , enroll at cs50.edx.org/programs/python (for Python) or cs50.edx.org/programs/data (for Data Science) instead.

How to Teach this Course

If you are a teacher, you are welcome to adopt or adapt these materials for your own course, per the license .

Python Forum

  • View Active Threads
  • View Today's Posts
  • View New Posts
  • My Discussions
  • Unanswered Posts
  • Unread Posts
  • Active Threads
  • Mark all forums read
  • Member List
  • Interpreter

Calendar program

  • Python Forum
  • Python Coding
  • 0 Vote(s) - 0 Average

Unladen Swallow
Mar-30-2020, 03:18 AM (This post was last modified: Mar-30-2020, 04:00 AM by .) when i run this it asks all the right questions but doesn't calculate properly?
Any help would be appreciated

Minister of Silly Walks

Mar-30-2020, 05:15 AM
Unladen Swallow
Mar-30-2020, 01:21 PM
  2,135 Sep-04-2023, 02:55 PM
:
5,093 Sep-09-2019, 03:25 PM
:
  5,967 Nov-13-2018, 07:34 PM
:
  8,717 May-01-2017, 02:56 AM
:
  • View a Printable Version

User Panel Messages

Announcements.

cs python fundamentals assignment 7

Login to Python Forum

Solutions of Computer Science with Python by Sumita Arora for Class 11 CBSE & NCERT

Computer science, 2023-24 syllabus.

Get the Reddit app

Need answers for a code practice? We got you! If you need answer for a test, assignment, quiz or other, you've come to the right place.

Assignment 8: Personal Organizer

Please help me with this code, I’ve been struggling all night

cs python fundamentals assignment 7

Introduction to Programming in Python

a textbook for a first course in computer science for the next generation of scientists and engineers

Our textbook Introduction to Programming in Python [ Amazon · Pearson ] is an interdisciplinary approach to the traditional CS1 curriculum. We teach all of the classic elements of programming, using an "objects-in-the-middle" approach that emphasizes data abstraction. A key feature of the book is the manner in which we motivate each programming concept by examining its impact on specific applications, taken from fields ranging from materials science to genomics to astrophysics to internet commerce. The book is organized around four stages of learning to program:

  • Chapter 1: Elements of Programming introduces variables; assignment statements; built-in types of data; conditionals and loops; arrays; and input/output, including graphics and sound.
  • Chapter 2: Functions and Modules introduces modular programming. We stress the fundamental idea of dividing a program into components that can be independently debugged, maintained, and reused.
  • Chapter 3: Object-Oriented Programming introduces data abstraction. We emphasize the concept of a data type and its implementation using Python's class mechanism.
  • Chapter 4: Algorithms and Data Structures introduces classical algorithms for sorting and searching, and fundamental data structures, including stacks, queues, and symbol tables.
  • Appendices provide supplemental material and a Python summary.

Reading a book and surfing the web are two different activities: This booksite is intended for your use while online (for example, while programming and while browsing the web); the textbook is for your use when initially learning new material and when reinforcing your understanding of that material (for example, when reviewing for an exam). The booksite consists of the following elements:

  • Excerpts. A condensed version of the text narrative for reference while online.
  • Exercises. Hundreds of exercises and some solutions.
  • Python code. Hundreds of easily downloadable Python programs and real-world data sets . real-world data sets .-->

To get started.

To get started you must install either a Python 3 or a Python 2 programming environment.

Here are instructions for installing a Python 3 programming environment [ Windows · Mac OS X · Linux ]. We recommend that you install and use the Python 3 programming environment.

Here are instructions for installing a Python 2 programming environment [ Windows · Mac OS X · Linux ]. We recommend that you use the Python 2 programming environment only if you have a compelling reason (external to the requirements of this book and booksite) to do so.

We also provide I/O libraries for reading and writing text, drawing graphics, and producing sound.

You can request an examination copy from Pearson.

  • How it works
  • Homework answers

Physics help

Answer to Question #238372 in Python for cj12

CS Python Fundamentals Assignment 1: Silly Sentences

Need a fast expert's response?

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS !

Leave a comment

Ask your question, related questions.

  • 1. Give an example of a nested conditional that can be modified to become a single conditional and show
  • 2. Give a strategy for avoiding nested conditionals .
  • 3. You are given a square matrix of size NxN, write a program to print the sum of upper and lower trian
  • 4. Write a program to print a parallelogram pattern with * characters. The size N represents the length
  • 5. You are given an integer N. Print N rows starting from 1 in the triangle order as shown in the expla
  • 6. Given an integer n , write a program to print the closest number that has all the even digits.condif
  • 7. odd one out given some space-separated list of integers, every element appears twice other than one
  • Programming
  • Engineering

10 years of AssignmentExpert

Who Can Help Me with My Assignment

There are three certainties in this world: Death, Taxes and Homework Assignments. No matter where you study, and no matter…

How to finish assignment

How to Finish Assignments When You Can’t

Crunch time is coming, deadlines need to be met, essays need to be submitted, and tests should be studied for.…

Math Exams Study

How to Effectively Study for a Math Test

Numbers and figures are an essential part of our world, necessary for almost everything we do every day. As important…

_images/CS1.jpg

Welcome to Python Programming Fundamentals Second Edition by Kent D. Lee. This text, available from Springer , is an introductory computer programming text. The text is oriented towards students who have not taken any other programming course previously. However, it can be used by students with some programming skills in another language. If you would like to begin learning Python programming on your own, you can begin by installing Python and Wing IDE 101 on your computer. Then buy my book and begin working through the many practice exercises and examples in the text. The links to the two YouTube videos below show you how you can install Python and Wing IDE 101 on your computer.

Installing Python and Wing IDE 101

I hope you enjoy reading the text and learning to program a computer using Python! It’s creative, fun, and the skills you will learn could provide you with access to a very fullfilling and rewarding career in Computer Science! Give it a try!

Errata and Suggestions ¶

I hope both professors and students enjoy using the text! I hope to get constructive feedback from folks so if you find an error or have a suggestion don’t hesitate to email me. My email is kentdlee at luther.edu. Please contact me via email if you have errata or suggestions and I will post them here.

On page 22. The sentence containing “Dividing 83/2 yields 41.5 if it is written 81/2” should be “… if it is written 83/2”.

Instructor Support Materials ¶

If you are an instructor using or considering using the text to teach a course and would like lecture slides, solutions to exercises, and answers to review questions I would be happy to provide them. Detailed lecture slides are available with all examples and practice problems from the text as well as solutions to all the exercises and review questions from the text. Please email me and provide me with information about where you are teaching and a web site where I can verify that you are a teacher at your institution and I will direct you to these support materials.

Support Files for Individual Chapters ¶

The following sections contain support files, instructional videos, and additional information for individual chapters. The support files may be downloaded by students or faculty to complete projects from each of the chapters below.

The sections below also contain videos for the various topics presented in the text. These videos help to reinforce the topics discussed in the text. I would recommend that you watch the video and then read the section of the text that goes along with the video for a more detailed explanation of the concepts in that section.

In addition, there are practice exercises in each section of the text (with answers at the end of the chapter) that you can use to test your understanding material. Use these exercises to motivate your reading of the text.

Chapter 1 ¶

The first chapter is about 30 pages long and contains a variety of learning objectives. This is perhaps the most broadly focused of the chapters in the text. Its goal is to give you some basis for talking about computer programming and to give you a gentle introduction to the process of writing programs. Specifically, the learning objectives of the first chapter are outlined below.

Section 1.3 - In this section of the text you use the Wing IDE to write a simple program. You learn the steps that you must take to open the Wing IDE, enter a program, and run it. Section 1.4 - In this section you learn a little about the architecture of a computer and some general terms to use when talking about computer programs. Sections 1.5 to 1.7 Part 1 - Covers conversion to binary. Sections 1.5 to 1.7 Part 2 - Signed and unsigned binary number representation is discussed. Sections 1.5 to 1.7 Part 3 - A first algorithm is presented and discussed. Sections 1.5 to 1.8 Part 1 - In these sections of the text, you learn about the importance of types in our programs and ASCII representation of characters. Sections 1.5 to 1.8 Part 2 - In this video you learn to use an assignment statement in Python to store a value in RAM and retrieve it later. Sections 1.9 and 1.17 - In section 1.9 and 1.17 you learn what a syntax error is, how to recognize it in your program, and how to fix it. Sections 1.10 to 1.14 - In this part of the text you learn about references, types, and type conversion. Sections 1.15 & 1.16 - Here you practice with strings and getting input from the user and printing output.

Chapter 2 ¶

In chapter 2 you learn how to make decisions in your programs using if statements. An if statements alters the sequence of executed statements depending on a condition. You also learn about the guess and check pattern of computation. This pattern is important to learn and memorize because you use it over and over in programs you write. Learning objectives for this chapter are outlined below.

Sections 2.1 & 2.2 - Here you learn about the guess and check pattern of computation. You can watch this video that goes along with these chapters. Sections 2.3, 2.4, & 2.5 - In these sections you learn about choosing from a list of alternatives, Boolean values, and short-circuit logic. The video below helps to further explain these concepts. Section 2.6 - In this section we learn that floating point numbers are only approximations of real numbers and therefore we must take some care when comparing floats for equality. It is likely that two floats will be close to the same value, but not exactly the same value, even when we would like them to be equal. The video below helps to illustrate this problem and the solution to it.

Chapter 2 Support Files ¶

In exercise 2 of chapter 3 the problem asks you to write a menu driven address book program. You can use this text file as the data file for your address book or you can create one yourself. Just be sure to use the same format as is presented in the book for your records within the file.

Chapter 3 ¶

In chapter 3 you learn how to repeatedly execute code in programs so you can process repetitive data. This is where computers really are important, since people don’t like to do the same thing over and over again. Computers are good at doing the same thing over and over. Again, there are video lectures below that complement the text.

Sections 3.1 & 3.2 - You should read the introduction to chapter 3 as well. In these two sections you learn about sequences and how to iterate over them. Section 3.3 - In this section you learn about nested for loops. Nested for loops are when you have one loop inside another loop. Section 3.4 - In this section of the text you learn how to use the guess and check pattern when a list is involved. Sections 3.5 & 3.6 - In these sections of the text you learn about the accumulator pattern and how to use it to count or add together a list of numbers.

Chapter 4 ¶

In chapter 4 you learn about objects and how to create objects and call methods on them. The chapter uses turtle graphics and XML parsing as two examples where many objects are created and methods are called.

Sections 4.1 to 4.3 - The introduction and these sections of the text show you how to use modules in Python and how to create some objects. This video complements these sections of the text. Plotting Data - In this video you learn how to use turtle graphics to plot data that you read from a file. In this video I read the file called djia-100.txt . This file is provided here for you to download if you want to try out my example. Section 4.8 - In this section of the text you learn about dictionaries in Python. It shows you how to create a dictionary, put a key/value pair in dictionary, and how to lookup a key in a dictionary to get its value. The video below demonstrates these concepts as well. Sections 4.6 to 4.9 - In these sections of the text you learn how to read and parse through the information in an XML file. XML documents are used in many different applications these days and understanding what an XML document is and how to read it in a program is a valuable skill. The video below helps to illustrate these ideas. This video use an XML file called kml.kml as an example. That file can be downloaded here if you want to try my example. Section 4.7 - In this section of the text I show you how to get at the attributes in an XML element. The attributes are recorded as a dictionary so you’ll want to know what a dictionary is first (see section 4.8 and its video above). In the video that goes along with this section I read a couple of XML files called biking3-15-2012.tcx and workouts.tcx . You can download these files here if you want to try my examples, but these files are large and a little unwieldy. You might start with some smaller XML files first (see the exercises at the end of the chapter in the text).

Support Files ¶

In chapter 4 there are several programming problems that must read data from a file. In a few cases, some code is provided to get you started. Each exercise’s extra files are provided below.

Exercises 2, 3, and 4 require you to read an XML file containing a picture. The XML file can be generated by using this drawing program , written in Python. You can download this program and run it with Python 3 to be able to draw a picture and save it to an XML file. The XML file for the picture in the text (Fig. 4.4 page 99) can be found here as flowerandbg.xml . Exercises 5 and 6 use mileage and fuel data from a 2007 Toyota 4Runner, a 2007 Nissan Versa, and a 2007 Suzuki S40 motorcycle. These two programs require you to read one of these data files below. This data was exported from a program called Gas Cubby that is available as an iPhone/iPod Touch App. Toyota4Runner.csv - Data for gas mileage for a 2007 Toyota 4Runner. NissanVersa.csv - Data for gas mileage for a 2009 Nissan Versa. SuzukiS40.csv - Data for gas mileage for a 2007 Suzuki S40 Motorcycle.

Chapter 5 ¶

Chapter 5 introduces you to defining and calling functions of your own. Functions offer us a means of abstracting away details and concentrating on what a function does instead of how it does it.

Defining and calling functions is discussed in this video and in sections 5.1 and 5.2 of the text. Functions and Scope are described in section 5.3 of the text and this video lecture. The Run-time Stack is described in this video lecture and section 5.4 of the text. Bottom-up Design is described in section 5.8 of the text and this video lecture. The Main Function is described at the end of chapter 5 and in this video lecture.

Chapter 6 ¶

Chapter 6 introduces Tkinter programming through an example Reminder application. Documentation for the Tkinter API can be found here. You can download the Reminder.py code from the example in that chapter here. Exercise 4 requires you to create an XML file to hold the reminder notes when the program is terminated and for the program to read when the application is started. You can use the format found below for your XML file. Name the file “Reminders.xml” and place the xml file in the same directory or folder as your program. You can begin this exercise by downloading the Reminder.py program from the link above and then modifying the code to read from an XML file using the minidom parser described in chapter 4. You can write to a file using Python’s file write method like the code in Reminder.py already does. Of course, you need to modify the code to write the file in this XML format so it can be read by the minidom parser.

One thing to be aware of: When using double quotes (i.e. “) in strings, you can you single quotes (i.e. ‘) to delimit those strings. Python lets you use either double or single quotes to delimit strings and this is one instance where using single quotes will come in handy.

One other thing to be aware of: Sometimes exception handling code (i.e. try except statements) get in the way of debugging your code. You may want to remove (or just comment out) the try except statements in the Reminders.py program before making modifications to it so you can see what errors occur when you make the modifications for this assignment. You should put the try except statements back in once you have debugged your code.

There is one video lecture for chapter 6 that goes along with the material in all of chapter 6 and teaches you about tkinter programming.

You can find the Reminder Application here as it is described in chapter 6 of the text.

Chapter 7 ¶

In chapter 7 there are two sample programs that are developed to demonstrate object-oriented programming and inheritance using Turtle graphics.

There are two video lectures that go along with this chapter.

Object-Oriented Programming and creating and using classes in described in this video. Inheritance is described in this lecture and the reuse of code through inheritance.
The first sample program is a drawing application. The source code for the drawing program can be downloaded here . The second example is a bouncing ball program and that code can be downloaded here. The bouncing ball program needs the soccerball.gif file to run. You might also like to make kitties bounce around, so kitty.gif is also provided. Chapter 7 includes an exercise on developing an asteroids application. There are five lessons that will take you through developing this application in some earlier materials called Sampling CS The five lessons below can be followed to implement the basic asteroids application. As part of the assignment in the text, you are to implement one more level to the application when level 1 is completed. The five lessons for the Asteroids game start with lesson 11 and links to them can be found at this location . In addition to the exercises at the end of chapter 7 I have had students implement a minesweeper game in the past. The Game Development with Python website contains lessons for developing games in Python including the minesweeper game (see lessons 14-18). These lessons will help guide students through building their own minesweeper application.

Table of Contents

IMAGES

  1. Chapter 7 Python fundamental

    cs python fundamentals assignment 7

  2. Python

    cs python fundamentals assignment 7

  3. CS 101 Programming Fundamentals

    cs python fundamentals assignment 7

  4. Python Fundamentals

    cs python fundamentals assignment 7

  5. Class 7 Computer Science Chapter 7 -More on Python part 1

    cs python fundamentals assignment 7

  6. Python Fundamentals Archives

    cs python fundamentals assignment 7

VIDEO

  1. Data Analytics & Data Science Class 01

  2. Day 04

  3. Day 05

  4. Day 08

  5. Day 11

  6. LESSON 4 Python Fundamentals : Learn Python LIVE 12:00

COMMENTS

  1. Intro to CS

    Intro to CS - Unit 7 Calendar Assignment . hey to any active members of this subreddit, if you can provide any sort of help on this assignment I'd appreciate it. I literally could not explain how confused I am over it. thanks in advance lmao Share Add a Comment. Sort by: Best. Open comment sort options ...

  2. Intro to computer science

    In this course, you'll use programming as a tool to measure environmental footprints, model infectious diseases, design game levels, and more. Starting with Python fundamentals like variables, conditionals, loops, and functions, you'll grow your programming toolkit as you build a portfolio of projects that showcase some of the exciting ways you can apply programming to real world problems!

  3. CS Python Fundamentals Flashcards

    Study with Quizlet and memorize flashcards containing terms like A command that displays text and numbers on the screen., A computer component that carries out a program's instructions., Information sent to the computer by the user, in the form of letters, numbers, or symbols. and more.

  4. Chapter 7: Python Fundamentals

    Get answers to all exercises of Chapter 7: Python Fundamentals Sumita Arora Computer Science with Python CBSE Class 11 book. Clear your computer doubts instantly & get more marks in computers exam easily. ... Python doesn't allow assignment of variables while they are getting printed. (c) a = input ("value") b = a / 2 print (a, b) Answer.

  5. Assignment 7: Calendar

    Beginning of dialog window. Escape will cancel and close the window.

  6. Introduction to Computer Science and Programming in Python

    6.0001 Introduction to Computer Science and Programming in Python is intended for students with little or no programming experience. It aims to provide students with an understanding of the role computation can play in solving problems and to help students, regardless of their major, feel justifiably confident of their ability to write small programs that allow them to accomplish useful goals.

  7. Python Assignment 7

    In this assignment, you will learn how to search for the index of multiple instances of a subset in a string.

  8. 100 Important Python Fundamentals Practice Questions

    Python Fundamentals Practice Questions Test 10. Q1. Write a program to accept radius of circle and display it's area and circumference. Show Answer. Ans. import math r=int (input ("Enter radius of circle")) print ("Area of Circle is ",math.pi*r*r) print ("Circumference of Circle is ",2*math.pi*r) Q2.

  9. CS python fundamentals unit 8 quiz Flashcards

    thank me later Learn with flashcards, games, and more — for free.

  10. CS50's Introduction to Programming with Python

    An introduction to programming using a language called Python. Learn how to read and write code as well as how to test and "debug" it. Designed for students with or without prior programming experience who'd like to learn Python specifically. Learn about functions, arguments, and return values (oh my!); variables and types; conditionals ...

  11. Calendar program

    The official dedicated python forum. This is my assignment calendar program that allows the user to enter a day, month, and year in three separate variables as shown below. Please enter a date Day: Month: Year: Then, ask the user to select from a menu of choices using this formatting: Menu: 1) Calculate the number of days in the given month. 2) Calculate the number of days left in the given ...

  12. 1.7 CS Fundamentals- Python Flashcards

    Study with Quizlet and memorize flashcards containing terms like int(), str(), string and more.

  13. Python Fundamentals Quiz 7

    Python is a proprietary software. Python is not case-sensitive. Python uses brackets for blocks and nested blocks. All of the above. Q62. In which of the following mode, the interpreter executes the statement and displays the result as soon as we press 'Enter' key? Interactive mode. Script mode. Hybrid mode.

  14. Assignment 7: Calendar edhesive python

    2. To find the number of days in a month, you make a function that contains if statements. If your variable "month" is 1, 3, 5, 7, 8, 10, or 12, it will return 31, as there are 31 days in each of those months. In your if statement for month 2, February, you will add leap_year (y) to 28. If it is not a leap year, it will add 0 to the number of ...

  15. Solutions of Computer Science with Python by Sumita Arora for Class 11

    Dictionaries. Get solutions to all chapters of Computer Science with Python by Sumita Arora book Class 11 CBSE & NCERT. Enjoy FREE doubts help & video explanations. This is your guide to ace computers exam easily.

  16. Assignment 8: Personal Organizer : r/EdhesiveHelp

    Python Please help me with this code, I've been struggling all night Share Add a Comment. Sort by: Best. Open comment sort options. Best. Top. New. Controversial. Old. Q&A. ... Assignment 7: Game Wheel upvotes ...

  17. Introduction to Programming in Python

    Textbook. Our textbook Introduction to Programming in Python [ Amazon · Pearson ] is an interdisciplinary approach to the traditional CS1 curriculum. We teach all of the classic elements of programming, using an "objects-in-the-middle" approach that emphasizes data abstraction. A key feature of the book is the manner in which we motivate each ...

  18. Project stem CS python UNIT 1 Flashcards

    1.8 lesson practice question 2. 2. Using a keyboard to write an email is an example of. Input. 1.8 lesson practice question 3. 3. Listening to music through headphones is an example of. Output. answers for project stem cs python fundamentals, quiz 1 and assignment 1 included ૮ ˶ᵔ ᵕ ᵔ˶ ა.

  19. Answer in Python for cj12 #238372

    CS Python Fundamentals Assignment 1: Silly Sentences Your physics assignments can be a real challenge, and the due date can be really close — feel free to use our assistance and get the desired result.

  20. Project stem CS python fundamentals UNIT 1 SV Flashcards

    1.4 lesson practice question 1. 1. Which of the following is true about software and hardware? Software refers to programs that run on the physical hardware of a computer. 1.4 lesson practice question 2. 2. Main memory is ___________. lost when the computer is powered off. 1.4 lesson practice question 3.

  21. Welcome!

    As part of the assignment in the text, you are to implement one more level to the application when level 1 is completed. The five lessons for the Asteroids game start with lesson 11 and links to them can be found at this location. In addition to the exercises at the end of chapter 7 I have had students implement a minesweeper game in the past.