Learn about Python Conditions

You are here: Home » Blog » Computer Programming Languages » Python » Learn about Python Conditions

Learn about Python Conditions

Exercise

Change the variables in the first section, so that each if statement resolves as True.

# code already changed. this is solution.
number = 16
second_number = 0
first_array = [1,2,3]
second_array = [1,2]

if number > 15:
    print("1")

if first_array:
    print("2")

if len(second_array) == 2:
    print("3")

if len(first_array) + len(second_array) == 5:
    print("4")

if first_array and first_array[0] == 1:
    print("5")

if not second_number:
    print("6")

Trinket.io on-line Python compiler

 


Related Videos:

MiltonMarketing.com Related Videos.

Related Posts:

Learn about programming Functions in Python

My little pony learning game in VB.NET

Introduction to JavaScript – CONSOLE

Introduction to JavaScript – Variables: String Interpolation

Learn Python Hello World Program

Using the Current Year in Your Posts – WordPress

Philips devs are coding algorithms that help detect cancer accurately

Learn List Comprehensions in Python Programming

Introduction to JavaScript – Variables

Hello World Android app built with Android Studio

FAQs

Who is this Android App Development course for?

Learn about Python Generators

Learn Python Variables and Types

Learn about programming Loops in Python

Python Serialization (JSON)

Learn about Dictionaries datatype for Python

Learn about Python Sets (lists)

Learn Partial functions Python programming

Python Basic String Operations

Python String Formatting

Learn Pandas Basics Python tabular data manipulation

Learn Multiple Function Arguments in Python

Python Basic Operators

Introduction to Python Programming Language

By |2019-03-28T18:52:31-04:00April 7th, 2018|Categories: Computer Programming Languages, Python|Tags: , |

About the Author:

I am a loving father, & husband. I am a computer enthusiast. I have used and enjoyed computers since I was young and I enjoy teaching young minds how to code, because it teaches them how to think. Today with YouTube, and social media garbage our youth are losing the ability to think on their own and solve problems. I believe this is a serious epidemic as kids today dont understand that technology is a tool. This tool is being abused, and its underlying effects are taking its toll on kids behaviour, and learning.