Skip to content

MavisK/python_101_one

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

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

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages