Write a program that picks a random number

Assignment Help Programming Languages
Reference no: EM131878816

Questions -

1. Write a program that counts down from 10. Implement your program first with a while loop.  Now implement your program with a for loop. Include both versions in your submission file.

2. Write a program that prints 2 n where n goes from 1 to 100. Print one answer per line (note: you are answering the question, how high can you count on 100 fingers). Write your program using a 'for' loop.  Reminder '**' is the operator for exponents, so for example 4**3 is 4 to the third power, or 4 * 4 * 4 which equals 64.

E.g.

2

4

8

16

....

3. Extend your guessing game from last week. Write a program that picks a random number from 1-100.  Then ask the user to guess a number. Tell the user if the answer is higher or lower than the number they guessed, or if they got the correct answer.  Allow them to guess again if they got the guess incorrect.  They should be able to guess numbers an infinite number of times until they get the correct answer, at which point your loop will end.

To generate a number from 1-100 you will need the following code at the beginning of your program:

from random import randint

randomNum = randint(1,100)

4. Extra Credit - Write a program that generates the multiplication table for numbers 1-10. Use two for loops to complete your program. You will need to put one for loop inside of the other for loop. As an extra challenge, see if you can get the indention to look correct. So the output of your program should be:

1  2  3  4  5  6  7  8  9

2  4  6  8 10 12 14 16 18

3  6  9 12 15 18 21 24 27

4  8 12 16 20 24 28 32 36

5 10 15 20 25 30 35 40 45

6 12 18 24 30 36 42 48 54

7 14 21 28 35 42 49 56 63

8 16 24 32 40 48 56 64 72

9 18 27 36 45 54 63 72 81

Reference no: EM131878816

Questions Cloud

Discuss the factors related to leadership of the lab : What are the factors which make the Langer lab very successful in technology commercialization?
Identify and research not-for-profit organization : Identify and research one (1) not-for-profit organization and provide the Web link to the most recent financial report of the organization.
Develop a survey to collect feedback from the employees : Imagine that you are a member of the HR department of a small retail company and upper management has asked you to create a new employee customer service.
Why the expected cash flows would be lower : Uncertainty Surrounding a Foreign Target: What are some of the key sources of uncertainty in Blore's valuation of the target?
Write a program that picks a random number : Extend your guessing game from last week. Write a program that picks a random number from 1-100. Then ask the user to guess a number
Sales department and the engineering department : Find the names and salary of each employee who works in both the Sales Department and the Engineering department
Price of the bond implied by the duration approximation : What would be the percentage change in the price of the bond implied by the duration approximation?
Write a program that has a conversation with the user : Write a program that has a conversation with the user. The program must ask for both strings and numbers as input
Why researchers believe trade is not the main cause : Briefly explain three reasons for why researchers believe trade is not the main cause. Which countries are land-abundant?

Reviews

len1878816

2/26/2018 12:26:21 AM

This criterion is linked to a Learning Outcome Solution to #1 - Countdown Program. 34.0 pts - Program works and code is well organized. 28.0 pts - Code runs but may not work correctly for some inputs. Code may not be well organized. 25.0 pts - Code doesn't run. Code shows some understanding of the programming concepts but needs significant changes to work on all inputs. 20.0 pts - Code doesn't run. Code doesn't display eunderstanding of programming concepts.

Write a Review

Programming Languages Questions & Answers

  Write a haskell program to calculates a balanced partition

Write a program in Haskell which calculates a balanced partition of N items where each item has a value between 0 and K such that the difference b/w the sum of the values of first partition,

  Create an application to run in the amazon ec2 service

In this project you will create an application to run in the Amazon EC2 service and you will also create a client that can run on local machine and access your application.

  Explain the process to develop a web page locally

Explain the process to develop a Web page locally

  Write functions

These 14 questions covers java class, Array, link list , generic class.

  Programming assignment

If the user wants to read the input from a file, then the output will also go into a different file . If the user wants to read the input interactively, then the output will go to the screen .

  Write a prolog program using swi proglog

Write a Prolog program using swi proglog

  Create a custom application using eclipse

Create a custom Application Using Eclipse Android Development

  Create a application using the mvc architecture

create a application using the MVC architecture. No scripting elements are allowed in JSP pages.

  Develops bespoke solutions for the rubber industry

Develops bespoke solutions for the rubber industry

  Design a program that models the worms behavior

Design a program that models the worm's behavior.

  Writing a class

Build a class for a type called Fraction

  Design a program that assigns seats on an airplane

Write a program that allows an instructor to keep a grade book and also design and implement a program that assigns seats on an airplane.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd