Python Simplified: A Guide to Programming in Python by Beth-el Anyebe

Python Simplified: A Guide to Programming in Python by Beth-el Anyebe

Author:Beth-el Anyebe [Anyebe, Beth-el]
Language: eng
Format: mobi
Published: 2022-03-31T00:00:00+00:00


Output - <class 'str'>

Converting to floats

Integers, as well as numbers written as strings, can equally be converted to floating-point numbers with the float() function, see how;

number = '45'

newnum = float(number)

print(type(newnum))

print(newnum)

Output - <class 'str'>

​45.0

LIST

A list in python is used in storing multiple data in one variable. An example would be a list of boys in a class or a list of girls in a class. Let's see how lists are written in python.

boys = ['ade', 'Kayode', 'Tunde', 'Segun']

girls = ['Sarah', 'Tayo', 'Eunice', 'Yemi']



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.