Using While Loop in Python
Code>
#using while loop in python
i = 1
while i <= 10:
print(i)
i += 1
else:
print("loop completed")
February 06, 2019 Davinder
#using while loop in python
i = 1
while i <= 10:
print(i)
i += 1
else:
print("loop completed")
February 06, 2019 Davinder
#using dictionaries in python
month_conversions = {
"jan" : "january",
"feb" : "feburary",
"mar" : "march",
}
print(month_conversions["feb"])
code / conversion / dictionaries / month / pyth / python
February 06, 2019 Davinder
#advanced calculator
num1 = float(input("Enter your first number: "))
op = input("Enter the operator: ")
num2 = float(input("Enter the second number : "))
if op == "+":
print(num1 + num2)
elif op == "-":
print(num1 - num2)
elif op == "/":
print(num1 / num2)
elif op == "*":
print(num1 * num2)
else:
print("Invalid Operator")
advanced / all / calculator / code / easy / python / screenshots / with
February 06, 2019 Davinder
def max(num1, num2, num3):
if num1 >=num2 and num1 >=num3:
return num1
elif num2 >= num1 and num2 >=num3:
return num2
else:
return num3
print (max(7,9,2))