I want to know how to do this assignment!!!
Help me please~
The first part of your program should do the following:
PART 2) FOR LOOPS WITH IF STATEMENTS INSIDE
PART 3) PYTHON
import random
x = random.randrange(1,4)
print(x)
#this picks a number between 1 and 4, but not including 4
#so it picks a number 1,2,3
PART 4) SOLVING MATH PROGRAMS BY RETURNING A VALUE.
Write a function called plusRoot that accepts three numbers (a,b,c). It should then find and return the root of the equation using the positive version of the quadaratic formula: .
Then write the pair function called negRoot that accepts three numbers (a,b,c) and finds and prints the 2nd root using the negative version of the quadratic. .
Then in your main program show that you program works by finding the roots of the two equations below, catching the result and printing out the results.
Answers should be 7 and -5.
Answers should be 2.5 and 3.5.
PART 5) RETURN FUNCTIONS
Remember the Collatz function? If x is odd, then but if x is even then . (remember to use // to divide by 2)
Start by writing a Collatz() function that returns the value for a given input. Test this function for all numbers from 1 to 10.
Next write a Collatz2() method. This method should take in a single number and repeatedly use the Collatz() function printing out the result while the number is not one.
For example:
|
If I say Collatz2(5) |
If I say Collatz2(12) |
|
Then the output should be : 5 16 8 4 2 1 |
Then the output should be : 12 6 3 10 5 16 8 4 2 1 |
Once you know it is working, run your method on the number n = 27 and see how long it takes to get to 1.
This is the long assignment to do at once. I have done the 3 parts. We are not allowed to answer long assignments. Please post the other questions separately. Let me know if you have any doubt.
#Part-A
test=input('Enter the type of test(ACT or SAT): ')
if test=='ACT':
score=int(input('Enter your score: '))
if score>=0 and score<=7:
print("Needs Work")
elif score>=10and score<=20:
print("Acceptable")
elif score>20:
print("Above average")
else:
score=int(input('Enter your score: '))
if score>=200 and score<=400:
print("Needs Work")
elif score>=401 and score<=1000:
print("Acceptable")
elif score>1000:
print("Above average")
#Part-B
for i in range(25,101):
if i>90:
print(i,':','A')
elif i>=80 and i<=89:
print(i,':','B')
elif i>=70 and i<=79:
print(i,':','C')
elif i>=60 and i<=69:
print(i,':','D')
else:
print(i,':','F')
#part-C
import random
print("You are playing Rock Paper Scisscors")
print("Enter your choice:\n1-for Rock\n2-for Paper\n3-for Scissor")
choice_identifier = int(input())
comp_choice= random.randrange(1,4)
if choice_identifier == comp_choice:
print('It\'s a draw!')
elif (choice_identifier == 1 and comp_choice == 3) or (choice_identifier == 2 and comp_choice == 1) or (choice_identifier == 3 and comp_choice == 2):
print('You win!')
else:
print('You lose...')
Output:
![Console 1/A In [10]: test-input(Enter the type of test(ACT or SAT): ) ...: if testACT .. score-int (input (Enter your score: )) if score>=0 and score<=7: elif score 1Øand score< 20: elif score>20: print(Needs Work) print(Acceptable) print( Above average) ...: else: score-int(input(Enter your score: )) if score 200 and score<-400: elif score>=401 and score<=1000 : elif score 1000: print(Needs Work) print (Acceptable) print( Above average) Enter the type of test(ACT or SAT): SAT Enter your score: 600 Acceptable](http://img.homeworklib.com/questions/6ed09590-a54e-11ec-bf81-bd6c8b343fc0.png?x-oss-process=image/resize,w_560)


I want to know how to do this assignment!!! Help me please~ The first part of...
In python: Not sure how to do a Collatz function. Remember the Collatz function? If x is odd, then collatz(x) = 3 ⋅ x + 1 but if x is even then collatz(x) = x/2. (remember to use // to divide by 2) Start by writing a Collatz() function that returns the value for a given input. Test this function for all numbers from 1 to 10. Next write a Collatz2() method. This method should take in a single number...
Assignment C++: Rock-Scissor-Paper & Tic-Tac-Toe i need you to write two different program for RSP and TTT: R-S-P Requirement: - write one program that mimics the Rock-Scissor-Paper game. This program will ask user to enter an input (out of R-S-P), and the computer will randomly pick one and print out the result (user wins / computer wins). - User's input along with computer's random pick will be encoded in the following format: -- user's rock: 10 -- user's scissor: 20...
Please help as it is very important task for me please write in Python code and divide this into function and write comments for it 1. Ask the player’s name and welcome them to the game using their name. 2. Ask the player what is par for this game (number between 3-5 inclusive) 3. Ask the player what the distance to the hole for this game is (whole number between 195 and 250 inclusive) 4. Show the game menu: (I)nstructions...
need help, dont understand how to set up.
1 You are a game developer at Microsoft Corporation and are charged with the task of developing games in C++. 2 Please develop a Rock Paper Scissor game for two players. Each player should have one of the following options: • 1. Rock • 2. Paper • 3. Scissor A. Player One: person You need to ask the person to enter one option from the above three. 10 B. Player Two: computer...
Using Matlab or Octave, I do not know how to write the
script for this problem, please help. Must match sample
output
5. Consider a 3 x 3 matrix given by A = 01 012 013 az az 633 ( dai 632 033 The trace of A is defined as tr(A)=2au. Given another 3 x 3 matrix bu bı2 bia B- bi brz bra | bgi bz2 by it can be shown that trAB') = tr(AB). Write a script that...
Use MATLAB to solve this problem. Thank you.
Upload the assignment to CANVAS, it should include two things: the PDF and the zipped folder. Late assignments are not accepted. For the questions below, do not create the arrays or matrices by hand. Instead, use built-in MATLAB functions and shorthand notations. Otherwise, no points will be given. 1) Create a function called my product that computes the multiplication of the numbers in any vector using a while loop. The function should...
Please help me write a Pseudocode (please do NOT answer in JAVA or Python - I will not be able to use those). Please ALSO create a flowchart using Flowgarithm program. Thank you so much, if answer is provided in Pseudocode and Flowchart, I will provide good feedback and thumbs up to the resonder. Thank you! Tic-Tac-Toe Game Write a program that allows two players to play a game of tic-tac-toe. Use a two- dimensional char array with three rows...
In python..
If we want the computer to pick a random number in a given range say to write code for Picking a random element from a list or pick a random card from a deck, flip a coin etc. we can use Random module The Random module contains some very useful functions one of them is randrange() randrange(start, stop) Example from random import randrange for i in range (3): print ("printing a random number using randrange(1, 7)",r andrange(1, 7))...
help me with the loops and the last part of this question .i am
using c language....speed=distance/time....in the 1st part of the
program i had to write a program to calculate speed...we had to
input distance in meters and time in seconds.
2. Strength. The robots will attempt to lift several heavy objects 3. Combat effectiveness. The robots will battle against 100 humans and then receive a score based on the number of victories. Create three functions (one for each...
Need help with assignment This assignment involves simulating a lottery drawing. In this type of lottery game, the player picks a set of numbers. A random drawing of numbers is then made, and the player wins if his/her chosen numbers match the drawn numbers (disregarding the order of the numbers). More specifically, a player picks k distinct numbers between 1 and n (inclusive), as well as one bonus number between 1 and m (inclusive). "Distinct" means that none of the...