Skip to content

Instantly share code, notes, and snippets.

# Arithmetic Operators in Python
# Integers
print('Division without remainder', 7 // 2) # Gives without floating number or without the remainder
print('Modulus', 3 % 2) # Gives the remainder
print('Exponentiation:', 3 ** 2) # it mean 3^2
print('Mutiplying complex numbers:', (1+1j) * (1-1j))
@ChuckleQu
ChuckleQu / 02_Day_Casting.py
Last active September 16, 2020 13:52
02_Day_Variables_builtin_functions
# Casting(转换):将一种数据类型转换为另一种数据类型
# int to float
num_int = 10
print('num_int:', num_int) # 10
num_float = float(num_int)
print('num_float:', num_float) # 10.0
# float to int
gravity = 9.81
@ChuckleQu
ChuckleQu / 01_Day_Introduction.py
Last active September 16, 2020 13:52
01_Day_Introduction
# Introduction
# Day 1 - 30DaysOfPython Challenge
print(2 + 3) # addition(+)
print(3 - 1) # subtraction(-)
print(2 * 3) # multiplication(*)
print(3 / 2) # division(/)
print(3 ** 2) # exponential(**)
print(3 % 2) # modulus(%)
print(3 // 2) # Floor division operator(//)