Section 1

Preview this deck

# A statement that tells Python to look for and load a module named 'os'

Front

Star 0%
Star 0%
Star 0%
Star 0%
Star 0%

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Active users

0

All-time users

0

Favorites

0

Last updated

6 years ago

Date created

Mar 1, 2020

Cards (19)

Section 1

(19 cards)

# A statement that tells Python to look for and load a module named 'os'

Front

import os

Back

# This statement begins a class definition

Front

class User(BaseClass):

Back

# The following statement spans multiple lines and creates a dictionary

Front

my_profile = { 'username': 'coolguy123' }

Back

# This statement increases the value of a variable called num_found

Front

num_found += 1

Back

# This statement says that a function should return a value

Front

return total_count

Back

# This statement adds to strings and returns the result

Front

"hello " + "world"

Back

# This statement returns the value of a variable named my_var

Front

my_var

Back

# This statement begins a function definition

Front

def get_most_recent(language):

Back

# This statement calls a function but all arguments must also be valid expressions. # In this case, one argument is a function that gets evaluated

Front

mix_two_colors(get_my_favorite_color(), '#000000')

Back

# This statement adds two numbers and returns the result

Front

5 + 3 # This statement adds two numbers and returns the result

Back

How to use "For Loop"

Front

In Python, "for loops" are called iterators. Just like while loop, "For Loop" is also used to repeat the program. But unlike while loop which depends on condition true or false. "For Loop" depends on the elements it has to iterate.

Back

# This statement begins a for-loop

Front

for player in players:

Back

A function

Front

A function is an object. There's statements to create functions, like def:

Back

How to use "enumerate" function for "For Loop"

Front

Enumerate function in "for loop" does two things 1. It returns the index number for the member 2.And the member of the collection that we are looking at

Back

Continue statement in for loop

Front

Continue statement can be used in for loop when you want to fetch a specific value from the list.

Back

While Loop Syntax

Front

while expression Statement

Back

# This is a statement that calls the print function

Front

print("hello")

Back

A statement

Front

A statement is a syntax construct

Back

# This statement assigns a value to a variable.

Front

first_name = "Kevin"

Back