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

Essential Python Keywords and Symbols

The document explains basic Python words and symbols, including how to import modules, get user input, and perform data type conversions. It covers essential functions like print(), loops with while, and various operators for comparison and assignment. Examples are provided for clarity on each concept.

Uploaded by

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

Essential Python Keywords and Symbols

The document explains basic Python words and symbols, including how to import modules, get user input, and perform data type conversions. It covers essential functions like print(), loops with while, and various operators for comparison and assignment. Examples are provided for clarity on each concept.

Uploaded by

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

Basic Python Words & Symbols Explained

import

Used to bring in Python modules (extra tools). Example: import time allows you to use time-related functions.

time

A module in Python used to work with time. Example: [Link](1) pauses the program for 1 second.

input()

Used to get input from the user. Example: name = input('Enter your name: ')

int()

Converts a string (text) into an integer (number). Example: int('5') becomes 5.

print()

Displays output on the screen. Example: print('Hello') shows Hello.

while

Starts a loop that repeats as long as the condition is true. Example: while x > 0 keeps going until x is 0.

[Link]()

Pauses the program for a number of seconds. Example: [Link](2) waits for 2 seconds.

seconds -= 1

Means subtract 1 from the current value of seconds. It's short for: seconds = seconds - 1

This is a comment. Python ignores anything after #. It's for humans to read.

=
Basic Python Words & Symbols Explained

Assignment operator. It stores a value in a variable. Example: age = 18

>

Comparison operator. Checks if something is greater. Example: if age > 17

==

Checks if two values are equal. Example: if x == 5

<

Checks if a value is less than another. Example: if x < 10

str

Data type for text. Example: 'hello' is a string.

int

Data type for whole numbers. Example: 5, 10, 999 are all integers.

You might also like