def get_price(a, b):
total = (a + b) * rate
return total
rate = 1.1
print(get_price(300, 700))
def get_price(a, b):
total = (a + b) * rate
return total
rate = 1.1
print(get_price(300, 700))
using namespace std;
int main()
{
for (int i = 1; i <= 100; ++i)
{
if (i % 15 == 0) {
// 3でも5でも割り切れる場合はFizzBuzzを出力
cout << “FizzBuzz\n”;
}
else if (i % 3 == 0) {
// 3で割り切れる場合はFizzを出力
cout << “Fizz\n”;
}
else if (i % 5 == 0) {
// 5で割り切れる場合はBuzzを出力
cout << “Buzz\n”;
}
else {
// それ以外の場合は数値を出力
cout << i << endl;
}
}
return 0;
}
def get_price(a, b):
total = a + b
return a + b
total = 30
print(get_price(300, 700))
print(total)
def show_ad():
print(“———“)
print(“SALE! 50% OFF!”)
print(“———“)
def show_content():
print(“BREAKING NEWS!”)
print(“Two baby pandas born”)
print(“at our Zoo!”)
show_ad()
show_content()
show_ad()
try:
initial_balance = int(input(“Initial Balance? “))
except ValueError:
print(“Invalid input, exiting … “)
exit()
RATE = 1.1
for year in range(3):
print(f”Year {year}: {initial_balance * RATE ** year:,.2f}”)
while ”:
command = int(input(“Select 1, 2, 3 (0: Exit) “))
match command:
case 1:
print(“Menu 1”)
case 2:
print(“Menu 2”)
case 3:
print(“Menu 3”)
case 0:
break
case _:
print(“Invalid command, try again”)
continue
print(“Menu processed correctly”)
while 1 == 1:
command = int(input(“Select 1, 2, 3 (0: Exit) “))
match command:
case 1:
print(“Menu 1”)
case 2:
print(“Menu 2”)
case 3:
print(“Menu 3”)
case 0:
break
case _:
print(“Invalid command, try agein”)
continue
print(“Menu processed correctly”)
while 1 == 1:
command = int(input(“Select 1, 2, 3 (0: Exit) “))
match command:
case 1:
print(“Menu 1”)
case 2:
print(“Menu 2”)
case 3:
print(“Menu 3”)
case 0:
pass
command = int(input(“Select 1,2,3 (0: Exit)”))
while command != 0:
match command:
case 1:
print(“Menu 1”)
case 2:
print(“Menu 2”)
case 3:
print(“Menu 3”)
command = int(input(“Select 1,2,3 (0: Exit)”))
initial_balance = int(input(“Initial Balance? “))
RATE = 1.1
for i in range(3):
if i != 0:
initial_balance += 10_000
for year in range(3):
print(f”Year {year}: {initial_balance * RATE ** year:,.2f}”)