This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| * Complete the vowelsAndConsonants function. | |
| * Print your output using 'console.log()'. | |
| */ | |
| function vowelsAndConsonants(s) { | |
| let vowels = ['a','e','i','o','u']; | |
| for(let v of s) { | |
| if(vowels.includes(v)) | |
| console.log(v); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def is_armstrong_number(number): | |
| num = str(number) | |
| exp = len(num) | |
| return number == sum([int(i)**exp for i in num]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def is_armstrong_number(number, exp=3): | |
| """ Checks if a number is an Armstrong number. | |
| An Armstrong number is a number that is the sum of its own digits each raised to the | |
| power of the number of digits. | |
| Args: | |
| number (int): The number to check. | |
| exp (int): The exponent to raise the digits to. | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* c++ function to check if the number is armstrong number or not */ | |
| #include <iostream> | |
| #include <cmath> | |
| using namespace std; | |
| int main() { | |
| int n, num, digit, sum = 0; | |
| cout << "Enter a positive integer: "; | |
| cin >> num; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def largestPalindrome(bot, top): | |
| z = 0 | |
| for i in range(top, bot, -1): | |
| for j in range(top, bot, -1): | |
| if isPalindrome(i*j): | |
| if i * j > z: | |
| z = i * j | |
| return z | |
| def isPalindrome(num): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from math import gcd | |
| def lcm(a, b): | |
| "Calculate the lowest common multiple of two integers a and b" | |
| return a * b // gcd(a, b) | |
| from functools import reduce | |
| result = reduce(lcm, range(1, 11)) | |
| print(result) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <bits/stdc++.h> | |
| using namespace std; | |
| // Complete the solve function below. | |
| void solve(double meal_cost, int tip_percent, int tax_percent) { | |
| int total_cost; | |
| total_cost = meal_cost + meal_cost * tip_percent/100 + meal_cost * tax_percent/100; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Complete the solve function below. | |
| function solve(meal_cost, tip_percent, tax_percent) { | |
| let total_cost; | |
| total_cost = meal_cost + meal_cost * tip_percent/100 + meal_cost * tax_percent/100; | |
| console.log(Math.round(total_cost)); | |
| } | |
| function main() { | |
| const meal_cost = parseFloat(readLine()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import math | |
| import os | |
| import random | |
| import re | |
| import sys | |
| # Complete the solve function below. | |
| def solve(meal_cost, tip_percent, tax_percent): | |
| total_cost = meal_cost + meal_cost * tip_percent/100 + meal_cost * tax_percent/100 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Read a full line of input from stdin and save it to our dynamically typed variable, input_string. | |
| input_string = input() | |
| # Print a string literal saying "Hello, World." to stdout. | |
| print('Hello, World.') | |
| # TODO: Write a line of code here that prints the contents of input_string to stdout. | |
| print(input_string) |