Due Date: February 26, 2024
Near Hundred
Purpose: Expand your knowledge of Java by learning
about boolean logic.
* Given an int n, return true if it is within 10 of 100 or 200.
* Note: Math.abs(num) computes the absolute value of a number.
*
* nearHundred(93) → true
* nearHundred(90) → true
* nearHundred(89) → false
Near Hundred - Click here.
Due Date: February 26, 2024
Positive Negative
Purpose: Expand your knowledge of Java by learning
about boolean logic.
* Given 2 int values,
* return true if one is negative and one is positive.
* Except if the parameter "negative" is true,
* then return true only if both are negative.
Positive Negative - Click here.
Due Date: February 26, 2024
Back Around
/* Instructions:
*
* Given a string,
* take the last char and
* return a new string with
* the last char added at the
* front and back, so "cat" yields "tcatt".
* The original string will be length 1 or more.
*
* backAround("cat") → "tcatt"
* backAround("Hello") → "oHelloo"
* backAround("a") → "aaa"
*
*
* Note: your value for this exercise will be different based on your seat number
*/
Back Around - Click here.
Due Date: February 26, 2024
Assignment:
-Copy fully functioning program to cyber range
-Run the python program.
-Drop it off into google classroom
use nano to create a python file.
example
nano PX_rockPaper_lastname.py
Be sure to create the following files:
PX_rockPaper_lastname.py (Actual python program)
PX_rockPaper_lastname.txt (Copy of python program (use google docs))
PX_rockPaper_lastname.png (Screen shot of program running)
PX_rockPaper_lastname.mp4 (Video of you running the program)
Be sure to drop these off into google classroom.
Source code:
from random import randint
#create a list of play options
t = ["Rock", "Paper", "Scissors"]
#assign a random play to the computer
computer = t[randint(0,2)]
#set player to False
player = False
while player == False:
#set player to True
player = input("Rock, Paper, Scissors?")
if player == computer:
print("Tie!")
elif player == "Rock":
if computer == "Paper":
print("You lose!", computer, "covers", player)
else:
print("You win!", player, "smashes", computer)
elif player == "Paper":
if computer == "Scissors":
print("You lose!", computer, "cut", player)
else:
print("You win!", player, "covers", computer)
elif player == "Scissors":
if computer == "Rock":
print("You lose...", computer, "smashes", player)
else:
print("You win!", player, "cut", computer)
else:
print("That's not a valid play. Check your spelling!")
#player was set to True, but we want it to be False so the loop continues
player = False
computer = t[randint(0,2)]