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

  Create a math tutoring program

You are being contracted to create a math tutoring program for a local elementary school.  This tutoring software should ask children which operation they would like to work on

  Critical review of recent segment disclosures

Assignment will require explanation and critical review of recent segment disclosures provided by Qantas Limited in its 2015 Annual Report.

  Write a function interpolate_1d(data,targ)

Write a function interpolate_1D(data,targ) where data is a list of tuples representing x and y data and targ is the target value of y. The function should return the interpolated value of x.

  Write c++ program that convert roman no. to decmial

Write C++ program that convert Roman no. to Decmial

  Write a program to operate the barriers

The entrance to the car park is on the left hand side. When a car drives into the car park there is a sensor that detects the car and this should cause the barrier to be opened to allow the car in.

  What is unixs main philosophy

Describe and critically evaluate the similarities between the Windows and Unix operating systems - what are some of the advantages of running UNIX and what is UNIX's main philosophy

  Display the temperature converted to celsius

Create an HTML form that prompts the user to enter a temperature in Fahrenheit. When the form is submitted, a JSP Web page should run that displays.

  One-dimensional as array of counters to solve problem

Write program which determines how many salespeople earned salaries in each of following ranges. Use the one-dimensional as the array of counters in solving this problem

  Compare all trees to all other trees.

Each line of values in input file "tree2Data.txt" represents one linear binary tree, where ' _ ' represents a no value node.

  Generate an object-oriented design for a system

Generate an object-oriented design for a system that keeps tracks of your CD and DVD collection. Identify each of the classes, associated data, and operations for the classes.

  What is programming

What is programming? Why it is so important in today environment?

  Explain the process of migrating existing data to testing

CMGT 445-Develop a data conversion plan that describes the process of migrating existing data to the testing platform. Explain the methods and procedures that will be used to conduct the testing.

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