guest = ['Jake', 'Fred', 'Joey']
guest_number = len(guest)
print(guest_number)
print("How many guest is it? Oh it's " + guest_number + ".")
TypeError: must be str, not int
emailRegex = re.compile(r'''
# some.+_thing@something.com
# [a-zA-Z0-9_.+]+ --> custom char class
[a-zA-Z0-9_.+]+ ##name part - custom char class, search for one or more
@ #@
[a-zA-Z0-9_.+]+ #domain name part --> search for one or more
''', re.VERBOSE)
Output:
[u'Uricks@astate.eduU', u'Utmohajir@astate.eduU', u'Ughogue@astate.eduU', u'Urhannah@astate.eduU']
guest = ['Jake', 'Fred', 'Joey']
guest_number = len(guest)
print(guest_number)
print("How many guest is it? Oh it's " + guest_number + ".")
TypeError: must be str, not int
print("How many guest is it? Oh it's ", guest_number, ".", sep="")
guest = ['Jake', 'Fred', 'Joey']
guest_number = len(guest)
print(guest_number)
print("How many guest is it? Oh it's " + guest_number + ".")
TypeError: must be str, not int
#include<stdio.h>
int main(int argc, char* argv[]) {
bool* isPrime = new bool[1000000]; // can't allocate large arrays the other way
int* primes = new int[1000000];
int nbPrimes = 0;
// Initialize isPrime:
// isPrime[i] will be true if i is prime
// at the end of the sieve
//
// At the beginning:
// - even numbers aren't -> false
// - odd numbers *can* be primes -> true
// - exceptions: 1 is not prime, 2 is prime
for(int i=0; i<1000000; ++i) {
isPrime[i] = (i%2 != 0);
}
isPrime[1] = false;
isPrime[2] = true;
// Compute primes with Erat. sieve
for(int i=0; i<1000000; ++i) {
// Take all numbers in order
// if there's true in isPrime[i],
// i is prime
if (isPrime[i]) {
primes[nbPrimes] = i; // Remember i
nbPrimes++; // One more prime
// Multiples of i are not primes
// Only odd multiples above i**2
// actually need to be removed,
// so only if i<sqrt(n)
if (i<1000) // 1000 is sqrt(1000000)
for(int m=i*i; m<1000000; m+=2*i)
isPrime[m] = false;
}
}
// Check conjecture
for(int i=4; i<1000000; i+=2) {
bool OK = false;
int k=0;
// Test all primes p <= i/2
// and check whether (i-p) is a prime
while (!OK) {
if (isPrime[i-primes[k]]) // We found a solution
OK = true;
else if (2*primes[k] >= i) { // We reached i/2
printf("The conjecture is false for %d\n", i);
OK = true;
}
k = k+1;
}
}
return 0;
}
private static void RestartSecondServer()
{
Console.WriteLine("Computer details retrieved using Windows Management Instrumentation (WMI)");
//Connect to the remote computer
ConnectionOptions co = new ConnectionOptions();
co.Username = @"***********";
co.Password = "*********";
ManagementScope ms = new ManagementScope("\\\\******\\root\\cimv2", co);
//Query remote computer across the connection
ObjectQuery oq = new System.Management.ObjectQuery("SELECT * FROM Win32_OperatingSystem");
ManagementObjectSearcher query1 = new ManagementObjectSearcher(ms, oq);
ManagementObjectCollection queryCollection1 = query1.Get();
foreach (ManagementObject mo in queryCollection1)
{
string[] ss = {""};
mo.InvokeMethod("Reboot", ss);
Console.WriteLine(mo.ToString());
Console.WriteLine("Reboot complete");
//Process.Start("shutdown", "/r /t 0");
}
}