Please refer to document attached.

1 answer below »
Please refer to document attached.


CP5805 Practical 1 - double-click and type your name here Once you've completed these tasks, name your file as Lastname_Firstname_prac_1.ipynb and submit on LearnJCU. E.g., if your name is Alice Smith, your file should be called Smith_Alice_prac_1.ipynb Task 1 In the code box below, write Python variable definitions for: · two variables that would be valid and well-named (we have done the first one for you) · two variables that would be valid, but not well-named Then write a comment that gives the rule for valid variable names in Python. In [ ]: first_name = "Guido" ​ Task 2 Consider the following problem description: A doctor needs to be able to calculate the total amount of a drug that has been administered to a patient. The system will get the hourly dosage from the user, as well as the number of hours they have been receiving the medicine. The system will then display the total for the doctor. Based on this description think about what variables you will need to receive as input, and display as output. Then design a solution in pseudocode in the comments below, then implement your solution in Python. In [ ]: # write your pseudocode as comments # # # # write your Python code here ​ Task 3 Alice is trying to make money trading a new cryptocurrency, Pythcoin. She has set the following rules for herself: · if the price of Pythcoin is 70.7 or higher, she sells · if the price of Pythcoin is 44.4 or lower, she buys - but only if her bank balance is $3000 or more · otherwise, she neither buys nor sells (sometimes known as HODLing) Based on Alice's trading strategy above, design and implement a program that asks the user for their bank balance, and then the current price of Pythcoin. The program should then display either: · It's time to sell · It's time to buy · Keep hodling In [1]: # write your pseudocode design as comments below # # # # # ​ # write your Python code here ​ ​ # what values should you use to test your code to make sure it works across all the different cases? # write your answer below # Task 4 Test the following code and try and identify any errors. (What values should you use for your tests?) Write what the problems were as a comment below. (Note that here we want a description of the problem, not the solution.) Then rewrite the code (change it in place) to fix any problems. In [ ]: age = input("How old: ") if age < 18:="" print("minor")="" elif="" age=""> 18: print("Adult") ​ # what problems did the code have to start with? # ​
Answered 3 days AfterSep 06, 2022

Answer To: Please refer to document attached.

Arun Shankar answered on Sep 10 2022
65 Votes
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here