HELLO WORLD PYTHON

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

floating point number in Python

A numerical value with a decimal component, represented in Python using the float type. These numbers are used when more precision is required than what integers can provide. Floating point numbers can represent very large or very small numbers, and they are crucial for calculations that require fractional values.

A string in Python

A sequence of characters enclosed in quotation marks. Python treats single quotes (' ') and double quotes (" ") interchangeably for defining strings. Strings can contain letters, numbers, and symbols. They are immutable, meaning once created, their content cannot be changed.

NameError in Python

An error that occurs when Python code attempts to access a variable, function, or module that has not been defined within the appropriate scope or has been misspelled. This error is raised during the runtime when the Python interpreter does not recognize the name because it is not defined or incorrectly referenced in the code.

ZeroDivisionError in Python

An error that occurs when a number is divided by zero. In Python, this operation is mathematically undefined and results in a ZeroDivisionError being raised to prevent the program from executing an invalid operation.

print() function in Python

Built in function that outputs the specialized message or output to the standard output device. customizable with several optional parameters separated by commas such as sep, end, file, and flush to control the formatting and destination of an output.

comments in Python

Lines in the code that are ignored by the interpreter during the execution of the program, used to annotate or explain the code for better human understanding. They start with a hash symbol (#) and extend to the end of the line.

Variables in Python

Named entities in a program that are used to store data values. Python variables do not need to be declared with any specific type and can change type after they have been set. A variable is created the moment a value is assigned to it, using the assignment operator =. Variables can store different types of data, including numbers, strings, and more complex data structures. They are fundamental for holding and manipulating data within a program, allowing for more dynamic and flexible code.

Arithmetic operations in Python

Python supports several arithmetic operations: addition (+, sums two values), subtraction (-, removes one value from another), multiplication (*, combines values), division (/, yields a quotient), modulus (%, returns the remainder of a division), exponentiation (**, raises a number to the power of another), and floor division (//, performs division but rounds down to the nearest whole number). These operations facilitate basic mathematical calculations.

modulo operator in Python

The % symbol, used to return the remainder of dividing the left-hand operand by the right-hand operand. It's an arithmetic operation that works with both integers and floating-point numbers.

plus equal operator in Python

The += operator in Python, known as the addition assignment operator, adds the value on the right to the variable on the left and then assigns the result back to the variable on the left. It simplifies the process of adding a value to a variable and then updating that variable with the new sum. This operator can be used with numbers to perform numeric addition or with strings and lists to perform concatenation.

String concatenation in Python

The process of combining two or more strings into a single string. The simplest method is using the '+' operator, which directly joins strings together. For example, concatenating "Hello" and "World" with a space can be done with str1 = "Hello" + " " + "World". Other methods include using the .join() method for combining a list of strings with a specified separator, the % operator or the format() function for inserting variables into strings, and f-strings (from Python 3.6 onwards), which allow embedding expressions inside string literals.


Set pelajaran terkait

Chapter 19 Multiple Choice Questions

View Set

Med Term Ch 17 Review Sheet Quiz

View Set

Therapeutic Drug Monitoring Vitamins and Nutrition

View Set