Due Date: January 25, 2024
Assignment
-Running Python in a Kali Linux environment
Mr. Cusack will lecture on this.
Cyber Range Sign on ids and passwords (Period 7)
Click here and get your id and password.
Click here for your cyber range.
https://apps.cyber.org/login
Notes:
To edit and run a python program in Linux
Sample:
nano test.py
-Type print("Lastname");
close nano
Run the python program.
Python3 test.py
Show Mr. Cusack
See code below:
Your file name will be P7_GuessNum_lastname.py
see code below: (a couple of syntax error are in the program.)
control-D to exit python
Use nano P7_GuessNum_lastname.py
Type the code.
Close nano.
Run the program
python3 P7_GuessNum_lastname.py
Your files to turn in:
- After you code your program you need to produce the follow artifacts.
P7_GuessNum_lastname.png (Screen Print of the python program)
P7_GuessNum_lastname.py (Actual python program)
P7_GuessNum_lastname.mp4 (Video of python program running)
Drop off your up to 7 files into google classroom.
Due Date: January 25, 2024
Assignment
-Running Python in a Kali Linux environment
-Generate the fibonacci Sequence
--------------------------------------
program:
def fibonacci_sequence(n):
"""
Generate a Fibonacci sequence up to the nth term.
:param n: Number of terms in the Fibonacci sequence to generate.
:return: List containing the Fibonacci sequence.
"""
sequence = [0, 1]
for i in range(2, n):
next_term = sequence[i-1] + sequence[i-2]
sequence.append(next_term)
return sequence
def main():
try:
num_terms = int(input("Enter the number of terms for the Fibonacci sequence: "))
if num_terms <= 0:
print("Please enter a positive integer.")
else:
fibonacci = fibonacci_sequence(num_terms)
print("Fibonacci Sequence up to", num_terms, "terms:")
print(fibonacci)
except ValueError:
print("Invalid input! Please enter a valid integer.")
if __name__ == "__main__":
main()
Run the program
python3 P7_fibonacci_lastname.py
Your files to turn in:
- After you code your program you need to produce the follow artifacts.
P7_fibonacci_lastname.png (Screen Print of the python program)
P7_fibonacci_lastname.py (Actual python program)
P7_fibonacci_lastname.mp4 (Video of python program running)
Drop off your up to 3 files into google classroom.