Coder Social home page Coder Social logo

pythonlab1's Introduction

PythonLab1

Use this for learning the findamenals of Python: https://docs.python-guide.org

The use of Python 3 is highly preferred over Python 2. Be sure to determine that your computer is running Python 3.

And you can use this as well: https://learnxinyminutes.com/docs/python3/ Stuff you should glance thru before you start..

  1. Primitive Datatypes and Operators
  2. Variables and Collections
  3. Control Flow and Iterables
  4. Functions
  5. Modules
  6. Classes

Each of these programs can be put into their own file. Learn how to run a python program from the command line.

Problem 1 - Sum of Fibonacci

Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be:

1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...

By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms.

Problem 2 - Counting Sundays

You are given the following information, but you may prefer to do some research for yourself.

1 Jan 1900 was a Monday. Thirty days has September, April, June and November. All the rest have thirty-one, Saving February alone, Which has twenty-eight, rain or shine. And on leap years, twenty-nine. A leap year occurs on any year evenly divisible by 4, but not on a century unless it is divisible by 400.

How many Sundays fell on the first of the month during the twentieth century (1 Jan 1901 to 31 Dec 2000)?

Problem 3 - Guessing Game

Write a guessing game where the user has to guess a secret number. After every guess the program tells the user whether their number was too large or too small. At the end the number of tries needed should be printed. It counts only as one try if they input the same number multiple times consecutively.

Problem 4 - Lists...

  • Write a function that returns the largest element in a list.
  • Write function that reverses a list, preferably in place.
  • Write a function that checks whether an element occurs in a list.
  • Write a function that returns the elements on odd positions in a list.
  • Write a function that computes the running total of a list.

here are a couple of python lists

fruits = ['orange', 'apple', 'pear', 'banana', 'kiwi', 'apple', 'banana']
 
stack = [3, 4, 5, 8, 13, 17, 35, 42]

Problem 5 - Calendar Print

Write a Python program to print the calendar of a given month and year. Take input from either the command line or from user input.

Note : Use 'calendar' module.

Problem 6 - Print Even Numbers

Write a Python program to print all even numbers from a given numbers list in the same order and stop the printing if any numbers that come after 237 in the sequence.

numbers = [ 386, 462, 47, 418, 907, 344, 236, 375, 823, 566, 597, 978, 328, 615, 953, 345, 399, 162, 758, 219, 918, 237, 412, 566, 826, 248, 866, 950, 626, 949, 687, 217, 815, 67, 104, 58, 512, 24, 892, 894, 767, 553, 81, 379, 843, 831, 445, 742, 717, 958,743, 527 ]

Problem 7 - Print word frequencies.

Write a Python program to read in the file "longtext.txt" as a string, convert the string to a list and then build a frequency table for every word in the list.

Print the 250 most frequent words.

Problem 8 - Flask

Create a directory for a micro blog web project and build a simple web app using the Flask web framework in side the directory. Keep it simple, student. Have a way to display all your blog posts. have a way to add a blog post. Don't bother with users/login and all that. Just focus on python, flask and some database.

see http://flask.pocoo.org/ for more on flask.

for extra credit of 12,675,632 points...

follow this https://realpython.com/flask-by-example-part-1-project-setup/ and get your flask app up on Heroku. (see heroku.com for what the hell Heroku is)

pythonlab1's People

Contributors

xt0fer avatar

Watchers

 avatar

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.