Lecture for 10/20/2022
This commit is contained in:
parent
e4cfe759e6
commit
9f2a91d67d
12 changed files with 423 additions and 0 deletions
27
lecture20261020/outputs01.py
Normal file
27
lecture20261020/outputs01.py
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
|
||||
data1 = input("Enter a value for data1 ")
|
||||
data1 = float(data1)
|
||||
|
||||
data2 = float( input("Enter a value for data2 ") )
|
||||
|
||||
|
||||
print("The value of data1 is ",data1)
|
||||
print("The value of data2 is ",data2)
|
||||
|
||||
|
||||
print("The type of data1 is ",type(data1) )
|
||||
print("The type of data2 is ",type(data2) )
|
||||
|
||||
|
||||
result = data1 + data2
|
||||
|
||||
print(result)
|
||||
|
||||
print("The result is ",result)
|
||||
# Wrong -- forgot braces
|
||||
print(f"The result is result")
|
||||
|
||||
print(f"The result is {result}")
|
||||
print(f"The result is {result:.2f}")
|
||||
print(f"The result is ${result:.2f}")
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue