Prepare a program with a function that will flip a coin

Assignment Help Python Programming
Reference no: EM132330132

Question

You need help creating a program with a function named flipCoin that will flip a coin as many times as the user asks. The flipCoin function should return "heads" or "tails". The program should continue while the user presses Y.

Sample output:

How many times do you want to flip a coin? 5

You got: tails

You got: tails

You got: tails

You got: tails

You got: heads

To continue press Y: Y

How many times do you want to flip a coin? 3

You got: heads

You got: tails

You got: tails

To continue press Y: N

Specifications:

• You will need to import random in your code

• The code to generate a number from 1 to the input sides is: flip = random.randint(1,2)

• Use the .upper() command to check upper and lowercase input example: cont = input("To continue press Y: ").upper()

Reference no: EM132330132

Questions Cloud

Write a regular expression that will replace all occurrences : Using the sub() method from the re package substitute all occurrences of the 'pattern' with 'substitution'.Output to the console replace_results.
How did the encounter between indians and europeans shape : How did the encounter between Indians and Europeans shape the development of the early colonies in the Americas? Please include in your paper an analysis.
Calculate distance traveled through speed and time driving : You need the code below to calculate Distance Traveled through Speed & Time Driving Versus Miles Per Gallon.
Describe preliminary analytic thesis statement : Based on your reading of Chapter 8 in Essaying the Past: How to Read, Write, and Think about History, your consideration of feedback received on your Week.
Prepare a program with a function that will flip a coin : You need help creating a program with a function named flipCoin that will flip a coin as many times as the user asks.
Create a program that will read in prices from the user : Create a program that will read in prices from the user and add them to a list. Ask the user in between each price if they want to continue (y/n).
Calculate the most appropriate descriptive statistics : Use the data to answer the following questions: Calculate the most appropriate descriptive statistics for Distance and LeadBefore
Display all of the scores entered and the total score : Ask the user in between each score if they want to continue (y/n). Display all of the scores entered and the total score at the end.
What are the major arguments for your view : After reading Terry Mortenson's Article on Creation (access the PDF link below), you must develop answers to the prompts below. Interact with specific details.

Reviews

Write a Review

Python Programming Questions & Answers

  Write a program that finds the longest word in dictionary

The letters A through F are used for writing hexadecimal numbers and can also spell a few English words.

  Create a simple and responsive gui

Please use primarily PHP or Python to solve the exercise and create a simple and responsive GUI, using HTML, CSS and JavaScript.Do not use a database.

  The program should allow the student

The program should allow the student to enter the answer. If the answer is correct, a message of congratulations should be displayed. If the answer is incorrect, a message showing the correct answer should be displayed.

  Write a python program that will ask the user for a string

Write a Python program that will ask the user for a string and then use the number of characters in the string to print out whether that value is odd or even.

  You need to do the run test page only

configure page will pass me the JSON object - what data is been flagged - What kind of test and object - how to find out bad data if the configure page is not

  Python programming to solve this problem

Write a statement that adds 1 to deansList and prints studentName to standard out if gpa exceeds 3.5.

  Construct a program that will simulate a push button

Project: PLC Programming with Ladder Logic - Construct a program that will simulate a push button activated LED - After this point the shutdown process

  Python script that reads and analyses ice cream data file

ICT702 - Data Wrangling - Read data from real sources and wrangle it into the form you need - compare sales in the five different regions

  Define three types of programming errors

Define three types of programming errors and explain with examples

  Write a python program that prompts the for the name

Write a PYTHON program that prompts the user for the name of the item and the price of each item, and then simply displays whatever the user typed.

  Modify your code to ask the user for the id of a restaurant

Copy check1.py to check2.py and continue to work on check2.py. Modify your code to ask the user for the id of a restaurant between 1 and 155 (humans don't need to know about list ids starting at 0).

  Write a function called acronym

Write a function called acronym. This function is passed a string s, and returns a string consisting of all of the capitalized letters in s.

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