Forum Replies Created

Viewing 15 posts - 1 through 15 (of 26 total)
  • Author
    Posts
  • in reply to: Lesson Review #7454
    Fine
    Participant

    I learned how python can be useful in math and what each of its functions does. Ceil() is the smallest integer>=x, Floor() is the largest integer<=x, int stands for integer, abs is an absolute value, and import random will generate random numbers. Today’s lesson was pretty fun because it’s not too complicated or simple, just right. I really like how python can be more than a computer language and do much more stuff such as math. It is amazing how it is able to print the product from the given function. Overall was good.

    in reply to: Record Answers Here for lesson 22nd March 2022 #7453
    Fine
    Participant

    Modules in Python Program 2

    a.Explain what the ceil() function does.
    – ceil() function returns the ceiling of x as an Integral. This is the smallest integer >= x.

    b.Explain the purpose of the floor() function.
    – foor() function returns the floor of x as an Integral. This is the largest integer <= x.

    c.Why are the calls to the floor() and ceil() functions preceded by “math.”?
    – It is used to find the smallest and largest integer.

    in reply to: Record Answers Here for lesson 22nd March 2022 #7451
    Fine
    Participant

    Modules in Python

    Run the program multiple times, and write down the output below.
    What is the purpose of “import random”? What happens if you omit that line of code?
    – Import random is when the program randomizes the variable. If you omit the code, the code will not work.

    How could you change the arguments of the randint function to choose a random number within the range of 4 to 10?
    – You basically change the number inside from 1-100 to 4-10, or the range of numbers that you want.

    code:
    import random
    print(random.randint(4,10))

    in reply to: Record Answers Here for lesson 22nd March 2022 #7448
    Fine
    Participant

    Can a function have more than 1 argument?
    – Yes, a function can have more than 1 argument if the arguments are combined and placed correctly.

    Can arguments be stored in variables?
    – Yes, an argument can be stored in variables because a function can be assigned to a variable.

    If a function contains more than one argument, do you think the order of the arguments makes a difference? Explain your answer.
    – Yes, if a function contains more than one argument, there will be a difference. Since the function are written in order, adding more arguments will affect the order of the printed function.

    in reply to: Python Input Output Activities 18th March #7427
    Fine
    Participant

    Predict the output and execute the following lines of code.

    name = input(“What is your name? “)
    print(“Your name is”,Name)
    a. Is the output what you would expect? Why or why not?
    – Error, the variable ‘name’ is all in lowercase while the print ‘Name’ ‘N’ is uppercase, so it won’t work.

    b. How can you alter the code so that it functions properly?
    – To make the function work, we change the letters to lowercase.
    So we get the code:
    name = input(“What is your name? “)
    print(“Your name is”,name)

    in reply to: Python Input Output Activities 18th March #7424
    Fine
    Participant

    a. What output do you expect?
    – I expected that the function would not work.
    b. What is the actual output
    – The function did not work due to an error.
    c. Revise the program in the following manner:
    Between lines two and three add the following lines of code:
    num1 = int(firstNumber)
    num2 = int(secondNumber)
    Next, replace the statement: difference = firstNumber – secondNumber
    with the statement: difference = num1 – num2
    Execute the program again. What output did you get?
    – The code is now working. Num1-Num2=difference.
    d. Explain the purpose of the function int().
    – The int() function is used to convert a value into an integer number. The int() function returns an integer object made up of a number or a string x, or 0 if no arguments are provided. To be converted to an integer object, a number or string must be provided.
    e. Explain how the changes in the program produced the desired output.
    – Changes in the program make the code work properly and output the desired output. Without making the changes, the program would have errors that hinders the program from working.

    CODE:
    firstNumber = input(“Enter a number: “)
    num1 = int(firstNumber)
    secondNumber = input(“Enter another number: “)
    num2 = int(secondNumber)
    difference = num1 – num2
    print(“*” * 10)
    print(“Difference = “, difference)

    in reply to: Python Input Output Activities 18th March #7422
    Fine
    Participant

    name = input(“Enter name: “)
    ID = input(“Enter your student ID number: “)
    course = input(“Enter your course number: “)
    print(name + “‘s ID is” + ID + “\nand is enrolled in “+ course)

    State what is displayed on the screen when you executed the program.
    – Displayed on the screen is a place to enter your name, student ID, and course number. The final result is name+student ID+course number.

    The \n is a “string literal escape sequence” in python. What does this do?
    – In Python, the new line character “\n” is used to create a new line. When inserted in a string all the characters after the character are added to a new line.

    Change the \n to \t and describe what happens to the program output.
    – Replacing /t with /n will replace a line with a tab.

    in reply to: Record Answers to Python Activity 11.2 #7420
    Fine
    Participant

    name = input(“Enter name: “)
    ID = input(“Enter your student ID number: “)
    course = input(“Enter your course number: “)
    print(name + “‘s ID is” + ID + “\nand is enrolled in “+ course)

    State what is displayed on the screen when you executed the program.
    – Displayed on the screen is a place to enter your name, student ID, and course number. The final result is name+student ID+course number.

    The \n is a “string literal escape sequence” in python. What does this do?
    – In Python, the new line character “\n” is used to create a new line. When inserted in a string all the characters after the character are added to a new line.

    Change the \n to \t and describe what happens to the program output.
    – Replacing /t with /n will replace a line with a tab.

    in reply to: Record Answers to Python Program 11.3 #7410
    Fine
    Participant

    PYTHON PROGRAM 11.3

    a. What is the output for the second line of code: print(gradebook)?
    – The output of the code is the scores of Abbot and Barrava.
    b. Examine the following code.
    for x in gradebook:
    print(x, end = ” “)
    print()
    i. What is being stored in x for each iteration of the loop in the following code?
    ii. What is the output of this code?
    – x stores the scores in the grade book. The output of the code is x(score) followed by ” “(name). It contains a FOR loop but does not use the range() function. In previous FOR loops the values resulting from the range() function were stored in x during each iteration of the loop

    in reply to: Record Answers to Python Activity 11.2 #7405
    Fine
    Participant

    PYTHON PROGRAM 14.4

    elements = [‘hydrogen’, ‘helium’ ,’lithium’, ‘beryllium’, ‘boron’, ‘carbon’]

    print(elements)
    elements.append(‘nitrogen’)
    print(elements)

    a. Explain what the following line of code does:

    elements.append(‘nitrogen’)
    – The code above adds the element ‘nitrogen’ into the list.

    b. Write a line of code that would add the element oxygen to the list.
    – On line 6-7 add

    elements.append(‘oxygen’)
    print(elements)

    to print oxygen in the list.

    in reply to: Record Answers to Python Activity 11.2 #7404
    Fine
    Participant

    PYTHON PROGRAM 11.3

    a. What is the output for the second line of code: print(gradebook)?
    – The output of the code is the scores of Abbot and Barrava.
    b. Examine the following code.
    for x in gradebook:
    print(x, end = ” “)
    print()
    i. What is being stored in x for each iteration of the loop in the following code?
    ii. What is the output of this code?
    – x stores the scores in the grade book. The output of the code is x(score) followed by ” “(name).

    in reply to: Record Answers to Python Activity 11.2 #7402
    Fine
    Participant

    PYTHON 11.2

    a. Instead of print(compoundClass[3]), type print(compoundClass[4]). If you put compoundClass[5]), it would not work because there is no compoundClass as it starts from compoundClass[0].
    b. compoundClass = [“alkanes”, “alkenes”, “alcohols”, “ketones”, “alkyl halides”, “alkynes”]
    print(compoundClass[5]) “alkynes” added to make compoundClass[5].
    c. compoundClass = [“alkanes”, “alkenes”, “alcohols”, “ketones”, “alkyl halides”, “alkynes”]
    print(compoundClass[-1]) We can see that it starts counting from the back, printing “alkynes”.
    e. compoundClass = [“alkanes”, “alkenes”, “alcohols”, “ketones”, “alkyl halides”, “alkynes”]
    print(compoundClass[-2]) Prints out alkyl halides.
    f. Positive will start at the front of the line while negative number starts at the end of the line.
    g. It prints out all the compoundClass written in the list, starting from alkynes and ending with alkynes.

    in reply to: Computer Resources on Various Computer Systems #7235
    Fine
    Participant

    – A supercomputer employs a large number of processors and employs a technique known as parallel processing, in which all of the processors work on the same problem at the same time. A server is a computer that stores and accesses a large amount of data or programs. computer workstation It may appear to be similar to a personal computer just by looking at it. However, it has a lot more power and is significantly more expensive. Toy Story was created on workstation computers, which are now by far the most common type of computer. A microcontroller is a small computer with a very specific function that you might find in your car. And while that one small feature is great, it’s not like you can use it as a regular computer.
    Limitation: Supercomputers can be quite costly. They also take up a lot of room and necessitate the use of specialized personnel. They may also have very specific applications, but they are not a substitute for physical testing.
    – A mainframe computer, also known as a big iron or a mainframe, is a computer used primarily by large organizations for critical applications such as censuses, industry and consumer statistics, enterprise resource planning, and large-scale transaction processing.
    Limitation: Extravagant prices. All users working on the system may be affected by a hardware issue. They also take up more room and necessitate the use of specialized operating systems.
    Difference:
    – Supercomputers: Supercomputers are the world’s largest and most expensive computers. The Supercomputer is invented by Seymour Cray. Large and complex mathematical computations are performed on supercomputers. Supercomputers have a faster processing speed than mainframe computers, allowing them to process billions of instructions or floating-point instructions in a single second.
    – Computers on Mainframes: Computers on Mainframes Computers are less expensive, have a smaller footprint, and run at a slower speed than supercomputers. are used to store large databases and to serve a large number of users at the same time. IBM creates the first successful mainframe computer. The speed of a mainframe computer is slower than that of a supercomputer. During this process, millions of instructions are executed at the same time.

    – Some roles of server: Domain controller, database server, backup server, file server, print server.
    – Time-sharing allows multiple people to use a computer system at the same time from different terminals.
    Digital Camera: A digital camera is a device that is used to take photographs. It is designed specifically for this purpose and focuses solely on that task.
    A mobile phone: Something you use every day and is an all-rounder since it can perform a wide range of tasks.

    in reply to: What is a Resource? #7197
    Fine
    Participant

    Resources can mean or refer to anything that is available and meets our desire. Any physical or virtual component of limited availability within a computer system is referred to as a system resource or simply resource, in computing. Resources include all connected devices as well as internal system components. Files, network connections, and memory areas are examples of virtual system resources.

    CPU: The Central Processing Unit. The processor, also known as the CPU, gives the computer the instructions and processing power it needs to function. The faster your computer can complete tasks, the more powerful and updated your processor is. If CPU is limited, no matter what you’re doing, your processor will be limited to a lower speed, generating less heat.

    Hard disk drive: A hard drive is a piece of hardware that stores all of your digital files. Digital content on a hard drive includes documents, photos, music, videos, programs, application preferences, and the operating system. Limiting your hard disk drive can cause your computer to slow down, resulting in freezes and crashes. If there isn’t enough virtual memory space left to act as an overflow, memory-intensive operations can cause the computer to freeze.

    RAM: RAM (random access memory) is a type of temporary computer storage that allows data to be received and read almost instantly. Instead of being written to the permanent hard drive, when you start a program, it is temporarily stored in your computer’s memory (or RAM) for easy access. If it is limited, your computer’s performance will degrade. That’s because, if your computer runs out of memory, it will compensate by using hard drive space as “virtual memory.”

    in reply to: GUI and CLI #7107
    Fine
    Participant

    1. User-friendliness: Most people can learn and use GUI much faster and easier because of the visual presentation than CLI, which requires more memorization and familiarity. In most cases, GUIs provide immediate visual feedback to the user, whereas CLIs frequently provide no visible feedback.

    2. Practicality: A graphical user interface (GUI) lacks the functionality and granularity of a command line interface. As a result, the CLI gives you more options when it comes to how you use it. It can be used to perform tasks that would be difficult or impossible to accomplish with a GUI.

    3. Quickness: Because a GUI requires more system resources to load the graphical portion, it will be slower than using the command line.

    4. The ability to multitask: Although many CLIs provide multiple window views, GUIs generally have a better ability to handle multiple tasks at once.

    5. Automation & Scripting: Users have complete control over the file system and operating system with a CLI, making tasks much easier. You can create a script with a few lines of code that will do all of the work for you. Although GUIs allow for the creation of shortcuts, they do not support scripting or automation. A user must manually repeat each action within the GUI for common tasks.

Viewing 15 posts - 1 through 15 (of 26 total)
Scroll to Top