Python. Tuples and strings can also be sliced and concatenated.
Let x = ['F','l','o','r','i','d','a']. How does cotDel(x, 3) compare to del x[3]?
Let y = ('F','l','o','r','i','d','a'). How does cotDel(y, 3) compare to del y[3]?
Let z = 'Florida'. How does cotDel(z, 3) compare to del z[3]?
Give an explanation about what you observed. This question refers to the following statement.
Define function cotDel(s,i) that deletes the ith item of list s, s[i]. In other words this function should do what the statement del s[i] does. Your function should use slicing and concatenation. Test your function with the list x of problem 1, deleting x[2]. Furthermore, your code should be written so that your program can be imported by other programs to make the function cotDel(s,i) available to them.
In: Computer Science
**MATLAB Code only
Please create a MATLAB script that is a TIC-TAC-TOE game. Please keep it simple, but there is no other rules. Thank you.
In: Computer Science
In: Computer Science
Password check, lab2pr1.py Many websites these days require that
a password
is between 8 and 20 characters, doesn’t have spaces, and satisfies
the following
conditions: contain at least one uppercase letter, contain at least
lowercase letter,
contain at least one number, and contain at least one special
symbol character
(”!?,.;:$# &”). Write a program that keeps asking the user to
enter the password
until they enter one that satisfies the requirements.
Please enter a password:
@Tulane2020
Please enter a password:
#Tulane2020
Password accepted
use python
In: Computer Science
Write a C++ Program. Include the Homework header.
Then prompt the user for a temperature that is in Fahrenheit for some water. Input the temperature (either an int or a double).
then output one of three statements:
if the temperature is below 32 degrees or below tell them it is ice. For example if they input 22 then the output would be:
At a temperature of 22 degrees the water would take the form of ice.
if the temperature is between 32 and 212 degrees then tell the user the water is in liquid form. For example if they input 140 the output would be:
At a temperature of 140 degrees water takes the from of liquid water.
if the temperature is greater than 212 degrees then tell the user. For example if they input 3300 the output would be: :
At a temperature of 3300 degrees water takes the form of a gas called steam.
then
Basically repeat the code. However, this time we will assume the temperature is in Celsius. So, ask for the temperature for this section of code in Celsius from the user.
And do the same description: if less than 0 degrees it is ice. If between 0 and 100 it is water and greater than 100 degrees it is steam.
Code Style:
For each section do not write three distinct if statements.
I expect to see if statements with else clauses.
When I say "I expect" it means if my expectations are not meet you get a low score.
Example of the console input and output we expect to see :
Enter the temperature in Fahrenheit : 12
At a temperature of 22 degrees the water would take the form of ice.
Enter the temperature in Celsius : 133
At a temperature of 133 degrees water takes the form of a gas called steam.
this is the code I have so far I do not know how to get it to just say liquid water or ice I cannot use the "and" or the "or"
#include <iostream>
using namespace std;
int main() {
double Fahrenheit;
double Celsius;
cout << "Enter the temperature in Fahrenheit : ";
cin >> Fahrenheit;
if (Fahrenheit < 33){
cout << "At a temperature of " << Fahrenheit << " degrees the water would take the form of ice. " << endl;
}
if (Fahrenheit < 213) {
cout << "At a temperature of " << Fahrenheit << " degrees water takes the from of liquid water." << endl;
}
else
cout << "At a temperature of " << Fahrenheit << " degrees water takes the form of a gas called steam." << endl;
cout << " Enter the temperature in Celsius : ";
cin >> Celsius;
if (Celsius <= 0){
cout << "At a temperature of " << Celsius << " degrees the water would take the form of ice. " << endl;
}
if (Celsius <= 100){
cout << "At a temperature of " << Celsius << " degrees water takes the from of liquid water." << endl;
}
else
cout << "At a temperature of " << Celsius << " degrees water takes the form of a gas called steam." << endl;
}
In: Computer Science
In: Computer Science
Your application will read in from the user an employee's name and salary, and print out a Console Check similar to the following. Your newly modified check printing application will this time accommodate names and numbers of different lengths WITHOUT pushing the left or right hand side of the check out of whack. >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> > | $1,000,000 | > > > > ___Pay to the Order of___ Johnny PayCheck > >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Pease only use technique from chapter 1-4 in C++ from control structyre 9th edition
In: Computer Science
C/C++ Programming in a UNIX Environment,
You should have read permission for the/etc/passwdfile. To answer the following questions, usecatorlessto display/etc/passwd. Look at the fields of information in/etc/passwdfor the users on the local system.
a.Which character is used to separate fields in/etc/passwd?
b.How many fields are used to describe each user?
c.How many users are on the local system?
d.How many different login shells are in use on your system? (Hint:Look at the last field.)
e.The second field of/etc/passwdstores user passwords in encoded form. If the password field contains anx, your system uses shadow passwords and stores the encoded passwords elsewhere. Does your system use shadow passwords?
In: Computer Science
Please fill in the code where it says to implement
Methods needed to implement include: insert, find, remove, and toIndex
//
// STRINGTABLE.JAVA
// A hash table mapping Strings to their positions in the the pattern sequence
// You get to fill in the methods for this part.
//
public class StringTable {
private LinkedList<Record>[] buckets;
private int nBuckets;
//
// number of records currently stored in table --
// must be maintained by all operations
//
public int size;
//
// Create an empty table with nBuckets buckets
//
@SuppressWarnings("unchecked")
public StringTable(int nBuckets)
{
this.nBuckets = nBuckets;
buckets = new LinkedList[nBuckets];
// TODO - fill in the rest of this method to initialize your table
}
/**
* insert - inserts a record to the StringTable
*
* @param r
* @return true if the insertion was successful, or false if a
* record with the same key is already present in the table.
*/
public boolean insert(Record r)
{
// TODO - implement this method
if() {
}
return false;
}
/**
* find - finds the record with a key matching the input.
*
* @param key
* @return the record matching this key, or null if it does not exist.
*/
public Record find(String key)
{
// TODO - implement this method
return null;
}
/**
* remove - finds a record in the StringTable with the given key
* and removes the record if it exists.
*
* @param key
*/
public void remove(String key)
{
// TODO - implement this method
}
/**
* toIndex - convert a string's hashcode to a table index
*
* As part of your hashing computation, you need to convert the
* hashcode of a key string (computed using the provided function
* stringToHashCode) to a bucket index in the hash table.
*
* You should use a multiplicative hashing strategy to convert
* hashcodes to indices. If you want to use the fixed-point
* computation with bit shifts, you may assume that nBuckets is a
* power of 2 and compute its log at construction time.
* Otherwise, you can use the floating-point computation.
*/
private int toIndex(int hashcode)
{
// Fill in your own hash function here
return 0;
}
/**
* stringToHashCode
* Converts a String key into an integer that serves as input to
* hash functions. This mapping is based on the idea of integer
* multiplicative hashing, where we do multiplies for successive
* characters of the key (adding in the position to distinguish
* permutations of the key from each other).
*
* @param string to hash
* @returns hashcode
*/
int stringToHashCode(String key)
{
int A = 1952786893;
int v = A;
for (int j = 0; j < key.length(); j++)
{
char c = key.charAt(j);
v = A * (v + (int) c + j) >> 16;
}
return v;
}
/**
* Use this function to print out your table for debugging
* purposes.
*/
public String toString()
{
StringBuilder sb = new StringBuilder();
for(int i = 0; i < nBuckets; i++)
{
sb.append(i+ " ");
if (buckets[i] == null)
{
sb.append("\n");
continue;
}
for (Record r : buckets[i])
{
sb.append(r.key + " ");
}
sb.append("\n");
}
return sb.toString();
}
}
In: Computer Science
ASSIGNMENT:
Pick one of the topics below and discuss:
1: IT Project Management
2: Information Security Management
In: Computer Science
Create a footer for web page using HTML,CSS,Javascript. The footer should contain
1.Back to top button
2.Random logo
3.Copyright content
In: Computer Science
Build a binary search tree with the following words. Insert them in an order so that the tree has as small a depth as possible. (Consider the insertion order of the words) Print the tree after,also, any, back, because, come, day, even, first, give, how, its, look, most, new, now, only, other, our, over, than, then, these, think, two, us, use, want, way, well, work.
C++
In: Computer Science
What is the status of the firewalld service on your system?
In: Computer Science
Which of the following is the most suitable for applications that need to have very fast real time response?
Choose one of the following answers.
1. Fog computing
2. Ubiquitous computing
3. Edge computing
4. Cloud computing
In: Computer Science
1. For each of the following statements find an equivalent statement in conjunctive normal form. Show the proof and truth table.
a) ¬(A ∨ B)
b) ¬(A ∧ B)
c) A ∨ (B ∧ C)
2. Is the following implication true or false? And if false, give an example that shows that it is false.
If S1 ∈ S2 and S2 ∈ S3, then S1 ∈ S3
In: Computer Science