0% found this document useful (0 votes)
76 views2 pages

Discussion Assignment Unit1

This document outlines the first computer science assignment, which involves setting up a Python programming environment and executing specific code statements. Students are required to explain the output of the code, compare it with textbook examples, and engage in discussions with peers. The importance of both integers and floats in Python is emphasized, highlighting their roles in accurate and efficient programming.

Uploaded by

SAYILE JAMES
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
76 views2 pages

Discussion Assignment Unit1

This document outlines the first computer science assignment, which involves setting up a Python programming environment and executing specific code statements. Students are required to explain the output of the code, compare it with textbook examples, and engage in discussions with peers. The importance of both integers and floats in Python is emphasized, highlighting their roles in accurate and efficient programming.

Uploaded by

SAYILE JAMES
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Hello and welcome to your first computer science assignment!

Before you begin exploring the


world of programming, you must finish the task of setting up the programming environment.
Let’s get started!

Download and install a working Python environment, preferably Python 3, or get an account with
PythonAnywhere. Please refer to the Software Requirements/Installation section located in the
course syllabus for details.

Type the statements below into your Python interpreter. For each statement, copy the output
into your Discussion Assignment and explain the output. Compare it with any similar examples
in the textbook, and describe what it means about your version of Python.

>>> print 'Hello, World!'


>>> 1/2
>>> type(1/2)
>>> print(01)
>>> 1/(2/3)

The code and its output must be explained technically whenever asked. The explanation can be
provided before or after the code, or in the form of code comments within the code. For any
descriptive type of question, your answer must be at least 150 words.

End your discussion post with one question related to programming fundamentals learned in
this unit from which your colleagues can formulate a response or generate further discussion.
Remember to post your initial response as early as possible, preferably by Sunday evening, to
allow time for you and your classmates to have a discussion.

When you reply to your peers’ submissions, compare their results with yours.

Solution

In Python, there are floating point numbers (floats) and positive whole numbers (integers).
Whole numbers are integers, but they also include decimal numbers (called floats). Python
needs both types of numbers, there are several reasons why.

* Integers * are often used for counting or keeping track of things that are not divisible by
fractions. Forexample, you might use an integer to keep track of the number of people in a
room, or the number of items in a shopping cart.

* Floats * are often used for calculations that involve decimals. Forexample, you might use a
float to calculate the area of a circle, or the distance between two points.

It can be important and really helpful to have both Integers and Floats in Python. Forexample,
you might use an integer to represent the number of items in a shopping cart, and a float to
represent the total cost of the items.
In some programming languages, integers and floats are combined into a single type of number.
This can be convenient, but it can also make it difficult to write code that is accurate and
efficient. Forexample, if you are writing code that needs to calculate the area of a circle, you will
need to convert the radius of the circle from a float to an integer before you can calculate the
area. This can introduce errors into your code, and it can also make your code slower. For these
reasons, it is important to have both integers and floats in [Link] allows you to write code
that is accurate, efficient, and easy to understand.

You might also like