Code Monkey home page Code Monkey logo

python_101_one's Introduction

Python Programming 101, first workshop, by http://zingpython.com/

Practical exercises:

1.Widgets and Gizmos. An online retailer sells two products: widgets and gizmos. Each widget weighs 75 grams. Each gizmo weighs 112 grams. Write a program that reads the number of widgets and the number of gizmos in an order from the user. Then your program should compute and display the total weight of the order.

2.Write a Python program that accepts a word from the user and reverse it.

3.FizzBuzz. Time for FizzBuzz in Python. Write a program that prints the numbers from 1 to 100. But if number is divisible by 3, print "Fizz" if i is divisible by 5, print "Buzz" if number is divisible by 3 & 5, print "FizzBuzz" if i is not divisble by 3 or 5, print number

4.Write a Python program to construct the following pattern, using a nested for loop.

*
**
***
****
*****
******
*****
****
***
**
*

5.Multiplication table. In this exercise you will create a program that displays a multiplication table that shows the products of all combinations of integers from 1 times 1 up to and including 10 times 10. Your multiplication table should include a row of labels across the top of it containing the numbers 1 through 10. It should also include labels down the left side consisting of the numbers 1 through 10. The expected output from the program is shown below:

        1    2    3    4    5    6    7    8    9   10 
   1    1    2    3    4    5    6    7    8    9   10 
   2    2    4    6    8   10   12   14   16   18   20 
   3    3    6    9   12   15   18   21   24   27   30 
   4    4    8   12   16   20   24   28   32   36   40 
   5    5   10   15   20   25   30   35   40   45   50 
   6    6   12   18   24   30   36   42   48   54   60 
   7    7   14   21   28   35   42   49   56   63   70 
   8    8   16   24   32   40   48   56   64   72   80 
   9    9   18   27   36   45   54   63   72   81   90 
  10   10   20   30   40   50   60   70   80   90  100 

When completing this exercise you will probably find it helpful to be able to print out a value without moving down to the next line. This can be accomplished by added end="" as the last parameter to your print statement. For example, print("A") will display the letter A and then move down to the next line. The statementprint("A", end="")will display the letter Awithout moving down to the next line, causing the next print statement to display its result on the same line as the letter A.

6.Write a Python program to guess a number between 1 to 9.

Note : User is prompted to enter a guess. If the user guesses wrong then the prompt appears again until the guess is correct, on successful guess, user will get a "Well guessed!" message, and the program will exit.

python_101_one's People

Contributors

programwithus avatar zingpython 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.