Python Programming: An Introduction to Computer Science, 3rd Ed.
3rd Edition
ISBN: 9781590282755
Author: John Zelle
Publisher: Franklin, Beedle & Associates
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
Chapter 1, Problem 2PE
Program Plan Intro
chaos program
Program Plan:
- Declare a main function. Inside the main function,
- Print the statement
- Get the value from the user
- Traverse the value of “x” through “for” loop until “x” reaches “10”.
- Evaluate the value of “x”.
- Print the value of “x”.
- Call the main function.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
can you solve this please?
Adopt appropriate Java animation code to implement the video in the file “test4.wmv” and given that the parametric equation for a circle.
x=r*cos(t)
y=r*sin(t)
with t in range [0, 2p] and r is the radius of the circle.
(the circle goes in a loop like in the images, i did my best to try to explain it , please try to do it )
and here is a sample of what they want me to use :
package javaapplication1;import java.awt.*;import java.awt.event.*;import javax.swing.*;import java.awt.geom.*;import java.util.Random;import javax.imageio.*;import java.io.File;import java.io.IOException;import java.awt.image.BufferedImage;import java.awt.event.*;import java.util.Calendar;
public class JavaApplication1 extends JApplet {
public static void main(String[] args) { JFrame frame=new JFrame(); frame.setTitle("hello"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JApplet applete =new JavaApplication1(); applete.init();…
Modify the program below to implement exclusive-or (XOR) in Python. AsPython does not natively implement XOR, you will need to implement this by creating an expression using a combination of and, or, and not. Determine what this expression is, and put it in the code below (where “fill in your code here” is written).The starter code below includes the True/True and True/False cases. You should also include the False/True and False/False cases. As a reminder, XOR is only True if exactly one of the inputs is True. Other ways ofthinking about this is that it is True only if one input or the other input is True, but not both. Yet another way of thinking about this is that the result is only True when the inputs are different from each other.
SAMPLE STARTER CODE:a = Trueb = Trueresult = # fill in your code hereprint("True XOR True is " + str(result))a = Trueb = Falseresult = # fill in your code hereprint("True XOR False is " + str(result))# Continue for the False/True and False/False…
can you add a screenshot showing that you are writing and running the code in Matlab/Octave.
Chapter 1 Solutions
Python Programming: An Introduction to Computer Science, 3rd Ed.
Ch. 1 - Prob. 1TFCh. 1 - Prob. 2TFCh. 1 - Prob. 3TFCh. 1 - Prob. 4TFCh. 1 - Prob. 5TFCh. 1 - Prob. 6TFCh. 1 - Prob. 7TFCh. 1 - Prob. 8TFCh. 1 - Prob. 9TFCh. 1 - Prob. 10TF
Ch. 1 - Prob. 1MCCh. 1 - Prob. 2MCCh. 1 - Prob. 3MCCh. 1 - Prob. 4MCCh. 1 - Prob. 5MCCh. 1 - Prob. 6MCCh. 1 - Prob. 7MCCh. 1 - Prob. 8MCCh. 1 - Prob. 9MCCh. 1 - Prob. 10MCCh. 1 - Prob. 1DCh. 1 - Prob. 2DCh. 1 - Prob. 3DCh. 1 - Prob. 4DCh. 1 - Prob. 5DCh. 1 - Prob. 1PECh. 1 - Prob. 2PECh. 1 - Prob. 3PECh. 1 - Prob. 4PECh. 1 - Prob. 5PECh. 1 - Prob. 7PE
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- (This is for devc++ but I use mindmap from Cengage. I know it a little different. If you can't use Cengage, I suggest devc++ version 5.11) One way to determine how healthy a person is, is by measuring the body fat of the person. The formulas to determine the body fat for female and male are as follows: Body fat formula for women: A1 = (body weight X 0.732) + 8.987 A2 = wrist measurement (at fullest point) / 3.140 A3 = waist measurement (at navel) X 0.157 A4 = hip measurement (at fullest point) X 0.249 A5 = forearm measurement (at fullest point) X 0.434 B = A1 + A2 - A3 - A4 + A5 Body fat = body weight - B Body fat percentage = body fat X 100 / body weight Body fat formula for men: A1 = (body weight X 1.082) + 94.42 A2 = waist measurement X 4.15 B = A1 - A2 Body fat = body weight - B Body fat percentage = body fat X 100 / body weight Instructions Write a program to calculate the body fat of a person. Prompt the user to input: Their gender ('m' or 'M' for male, 'f' or 'F' for…arrow_forwardA word is called as a good word if all the letters of the word are distinct. That is, all the letters of the word are different from each other letter. Else, the word is called as a bad word. This can be continued based on the user input is 'Y'.arrow_forwardWrite a computer program for calculating carburization heat treatments. The program should ask the user to provide an input for the carbon concentration at the surface (cs), and the concentration of carbon in the bulk (c0).arrow_forward
- Develop a program to find the distance travelled by a vehicle, given it’s initial velocity ‘u’,acceleration ‘a’ and time ‘t’. For understanding, you may use the snippet of sampleoutput. Rest you have liberty to provide code with sample execution output.arrow_forwardDo this with "emu8086 " . Please add screenshot alsoarrow_forwardCreate Python programming in Physics and Materials Science. In physics, chemistry, and materials science, percolation refers to the movement and filtering of fluids through porous materials. (Wikipedia.org). Consider a simplified model below. Imagine, this is a filter or maybe some layers of stones such that when a certain amount of fluid is put on top, it will reach the bottom only if there is a direct passage. In this case, the blue squares serve as the porous materials or the holes where fluid may pass. Your task is to simulate this simple percolation by representing them in a 2-dimensional array. The input would be in a string, while the output would either be yes or no to indicate whether the fluid can pass through the filter or not. Examples: Input: “1,0,0,0,0;0,1,0,0,0;0,1,0,0,0;0,0,1,0,0;0,0,0,1,0”Output: Yes Input: “0,0,0,1,0;0,1,0,0,0;0,1,0,0,0;0,0,1,0,0;0,0,0,1,0”Output: No Input: “1,0,0;0,1,0;0,0,0;0,0,1”Output: No Note: It should also work with these two inputs:1. “1”…arrow_forward
- Give answer in python code, and correct output. In image i have given problem statement.arrow_forward1. Write a Java program that will read numbers between 1 and 14 and will output the appropriate symbol for a playing card of that rank (use switch). For cards between 2 and 10 just print the rank, for 1 and 11 print "Ace", for 12 print "Jack", for 13 print "Queen", and for 14 print "King". Use a for loop to read and process n cards (input from user). Your program should also handle invalid input.arrow_forwardGenerate a list of 10 random numbers with values between 1 and 20, and submit the first 10 numbers as an answer to this question. (Use any random number generator). For the purpose of using them in the next questions, call these numbers A, B, C, D, . . . J Convert Aπ/B into degrees. Find the result ofa. Degrees = (A × B × C) + 180 mod 180; this is the remainder after dividing (A × B × C) + 180 by 180 b. Convert Degrees into radians, and put the answer in π notation. Calculate the measurements of the acute angles of a right triangle whose sides measure A, B, C units. Build a matrix, M, of random numbers as follows: A B C D E F G H I What is MT? Find the inverse of M, showing the steps. What is the result of M * M−1? Let V = [A B C] and W = [ D E F]. In the textbook, the dot product V • W involves an angle, alpha (α). How do you calculate alpha for this example? Let V = [A B C]. Find the cross product V • V. What can you conclude from this…arrow_forward
- Write an LMC program that generates the Fibonacci series. Write a Little Man program that prints out the multiples of 7 starting from 7 to 83. Also keep a running total and output at the end the sum of 7+14+...83. Turn in the code and a screen shot of the program at completion.arrow_forwardPick a number, any number (actually, make it a positive integer). Now, let's play a game. If your number is even, divide it by 2. If it is odd, multiply it by 3 and add 1. Repeat this process with your new number. Repeat over and over again. Lothar Collatz in 1937 guessed that this process will always eventually end at the number 1. Write a Matlab function file that takes an input n (assume the user enters a positive integer) and runs through the Collatz process until a 1 is reached. The function should output count, the number of iterations necessary to reach 1. As a test, your code should report that 63 iterations are necessary if we start with the number 2020.arrow_forwardWrite a program that will figure out the required change for a purchase. Start by asking the user for the price of the product and the amount paid. (We are expecting that the user will give a larger value for the amount paid.) Read in each of these values as a double. Report back to the user the number of each denomination of change due. You are not just telling the user the amount of money he gets back. Hint: Working with integers is much easier. The modulo operator is your friend for this assignment. Also, note that pennies can be tricky due to the poor real number to binary conversions. (Remember that 1.00 could actually be stored as 0.9999999999997.) Do not include five-dollar bills, ten-dollar bills, etc. Only show coins and one-dollar bill amounts. Be sure to test multiple values. There is a test case below. Your program should run the test case exactly as it appears below, and should work on any other case in general. Output Example (User input is marked with >>>.…arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning