Aa.X= {}
Is it a set or a dict
It is a dictionary, if you want to declare an empty set you do it in the following way: x = set()
Aa.But it shows same curly bracket for sets here
it's right:
empty list: x = []
empty set: x = set()
empty tuple: x = ()
empty dictionary: x = {}
With data it will look like this:
x = [1, 2, 3, 4]
x = {1, 2, 3, 4}
x = (1, 2, 3, 4)
x = {'one': 1,'two':2, 'three': 3, 'four': 4}
Aa.Thanks a lot.
What's the use of empty lists, sets, tuples, dicts really?
They are often used as containers to store data that will be added later during program execution. For example, you can create an empty list and then add items as the data is processed. Empty sets can be used to store unique items, empty tuples can be used as placeholders, and empty dictionaries can be used to store key-value pairs.
id 1989194811What am i doing wrong ?
Can anybody explain how to convert from int to float
Use float instead of int
id 1989194811What am i doing wrong ?
Can anybody explain how to convert from int to float
In line 1 & 2, you have been using print function which will return None. Do not user print function
id 1989194811What am i doing wrong ?
Can anybody explain how to convert from int to float
U didn't give colon
Print(input('enter height: '))
Dagmawi MindaHELP me! The question is as follows...
Find the length of the text python and convert the value to float and covert it to string?
text ="this is a text"
To get the size you can use python's len function:
len(text)
The result can be stored in a variable:
size = len(text)
We convert the result to a float:
print(float(size))
id 1989194811What am i doing wrong ?
Can anybody explain how to convert from int to float
A= int(input("enter height"))