This file contains 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
hrs = float(input("Enter Hours:")) | |
rate = float(input("Enter the Rate:")) | |
if hrs <= 40: | |
print( hrs * rate) | |
elif hrs > 40: | |
print(40* rate + (hrs-40)*1.5*rate) |
This file contains 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
score = float(input("enter a score:")) | |
s = score | |
if 0.0 <= s <= 1.0: | |
if s >= 0.9: | |
result = "A" | |
print(result) | |
elif 0.8 <= s < 0.9: | |
result = "B" |
This file contains 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 computepay(h, r): | |
if h > 40: | |
p = 1.5 * r * (h - 40) + (40 * r) | |
else: | |
p = h * r | |
return p | |
hrs = float(input("Enter Hours:")) | |
rphrs = float(input("Enter rate per hour:")) |
This file contains 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
largest = None | |
smallest = None | |
while True: | |
num = input("Enter a number: ") | |
if num == "done": | |
break | |
try: | |
n = int(num) | |
if smallest is None or n < smallest: |
This file contains 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> | |
#define REP(i,n) for (int i = 0; i < n; i++) | |
#define mod 1000000007 | |
#define pb push_back | |
#define ff first | |
#define ss second | |
#define ii pair<int,int> | |
#define vi vector<int> | |
#define vii vector<ii> | |
#define lli long long int |
This file contains 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++ program to rotate an array by d elements | |
#include <bits/stdc++.h> | |
using namespace std; | |
/*Function to left Rotate arr[] of size n by 1*/ | |
void leftRotatebyOne(int arr[], int n) | |
{ | |
int temp = arr[0], i; | |
for (i = 0; i < n - 1; i++) | |
arr[i] = arr[i + 1]; |
This file contains 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
package main | |
import ( | |
"log" | |
"net" | |
"os" | |
) | |
func main() { | |
hostname, _ := os.Hostname() // get hostname | |
addrs, err := net.LookupIP(hostname) // returns a slice of the IP addresses of the host | |
// lookupIP looks up host using the local resolver. It returns a slice of that host's IPv4 and IPv6 addresses. |
This file contains 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 java.io.*; | |
import java.net.*; | |
public class InetSampleCode { | |
public static void main(String[] args) { | |
try { | |
InetAddress id = InetAddress.getLocalHost(); | |
System.out.println("Host Name: " + id.getHostName()); | |
System.out.println("IP Address: " + id.getHostAddress()); | |
} catch (Exception e) { |
This file contains 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
// You can edit this code! | |
package main | |
import ( | |
"log" | |
"time" | |
) | |
func main() { | |
// get current time in UTC timezone |
This file contains 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
package main | |
import ( | |
"github.com/sirupsen/logrus" | |
) | |
func main() { | |
var log = logrus.New() | |
log.SetFormatter(&logrus.JSONFormatter{ | |
// DisableTimestamp: false, // Default: false |
OlderNewer