Learn Python Variables and Types

////Learn Python Variables and Types

Learn Python Variables and Types

Exercise

The target of this exercise is to create a string, an integer, and a floating point number. The string should be named mystring and should contain the word “hello”. The floating point number should be named myfloat and should contain the number 10.0, and the integer should be named myint and should contain the number 20.

# code already changed here.
mystring = "hello"
myfloat = 10.0
myint = 20

# testing code
if mystring == "hello":
    print("String: %s" % mystring)
if isinstance(myfloat, float) and myfloat == 10.0:
    print("Float: %f" % myfloat)
if isinstance(myint, int) and myint == 20:
    print("Integer: %d" % myint)

Trinket.io on-line Python compiler

 

Related Videos:

MiltonMarketing.com Related Videos.

Related Post:

Learn Multiple Function Arguments in Python

Python Basic String Operations

Learn about programming Functions in Python

Learn Code Introspection Python Programming

Learn Pandas Basics Python tabular data manipulation

Introduction to Python Programming Language

Learn about Python Sets (lists)

Learn about Dictionaries datatype for Python

Python Basic Operators

Comparing Python to other languages

Learn about Numpy Arrays in Python programming

 

By |2019-02-08T19:21:28-05: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.