Git Product home page Git Product logo

chapters2to4's Introduction

Chapters2to4

#CHAPTER 2 Exercises

#Exercise 1

yes="all" this= "work" sentence="and" makes="no" alot="play" of="makes" sense="Jack" to="a" us="dull" now="boy" print(yes, this, sentence, makes, alot, of, sense, to, us, now)

#Exercise 2

print(61-2) print(6(1-2))

#Exercise 3

yes="all" this= "work" sentence="and" makes="no" alot="play" of="makes" #this is a comment so we can see what happens, sense="Jack" #which is nothing because this is only for humans to read to="a" us="dull" now="boy" print(yes, this, sentence, makes, alot, of, sense, to, us, now)

#Exercise 4

bruce=6 print(bruce+4) #now "bruce" is a defined variable

#Exercise 5

response=input("How many years are you investing your money? ") P=10000 n=12 r=0.08 t=float(response) Amount=P*(1+r*(1/n))**n*t print("Your final amount after t years will be", Amount)

#Exercise 6

7%0 #Traceback (most recent call last): #File "", line 1, in #ZeroDivisionError: integer division or modulo by zero #Zero division error appears with this command

#Exercise 7

#2pm + 51 hours is 5 pm. The clock will go off at 5 pm or in military time, 17:00

#Exercise 8

currenttime=float(input("What time is it now? (0-24)" )) hours=float(input("How many hours are you waiting?" )) resulttime=int(currenttime+(hours%24)) if resulttime>24: resulttime%24+currenttime standardtime=resulttime%12 if standardtime>12: standardtime%12 if standardtime<12: print("Your clock will go off at", resulttime, ":00") answer=input("Do you want this in 12-hour clock?" ) if "yes": print("this is also", standardtime)

chapters2to4's People

Contributors

anniepod avatar

Watchers

James Cloos avatar

chapters2to4's Issues

Chapter 3

5c - You just need to print out the sum once at the end.

5d - You need to print out the product of all numbers in xs. Your program is printing each item's square
6e - this was extra so it doesn't count for a grade - but it's not working

8 - missing, you just need to get the heading() at the end of ex 7

11 - your star is upside down
12 - revise - it looks weird

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.