Let's address the few mistakes in your code so far. First, age is of type string and year is of type int. You're trying to subtract an int by a string and that doesn't work. Also, you have inconsistent quotes "Hello '. You should always use the same type of quote. The (year - age)) isn't properly formatted into the print statement. There is no plus adding it.
Here's my working code:
import datetime
name = input("What is your name? ")
age = int(input("How old are you? "))
year = datetime.datetime.now().year
print("Hello " + name + " you were born in " + str((year - age)))
I just fixed your code. Best of luck.
In python, date and time seem to be not its type of data, but the date and time named module can be imported for it to work with the time and date. So, the program and its description can be defined as follows:
Program Explanation:
Importing "datetime" package.Defining two-variable "name, age" in which we input value from user-end.Defining another variable "year" that holds current year value.In the next step, the print method has used that prints the user name with the born year.Program:
import datetime#import package datetime
name = input("What is your name? ")#defining a variable name that uses an inputs method to input string value
age = int(input("How old are you? "))#defining a variable age that uses an inputs method with the int to input value
year = datetime.datetime.now().year#defining a variable year that takes current value in it
print("Hello " + name + " you were born in " + str((year - age)))#defining a print method that print name value with born year
Output:
Please find the attached file.
Learn more:
brainly.com/question/19032453
Ask the user how many numbers for which they want to calculate the sum. Using a for loop, prompt the user to enter that many numbers, one-by-one, keeping track of the sum. At the end, after the user entered all numbers, output the sum.
n = int(input("How many numbers do you want to sum? "))
total = 0
for x in range(n):
total += int(input("Enter a number: "))
print("Sum: "+str(total))
I hope this helps!
Following are the program to the given question:
Program Explanation:
Defining a variable "Sum" that holds an integer value.In the next step, a variable "t" is defined that uses the input method to input a value from the user-end.After the input value, a for loop is declared that takes the range of the t variable.Inside the loop, another variable "n" is defined that inputs value from user-end and use the "Sum" variable to add its value.Outside the loop, a print method has been used that prints the sum variable in the string with the message.Program:
Sum = 0#defining a variable sum that hold an integer value
t= int(input("Enter the total number you want to add: "))#defining a t variable that input value from user-end
for i in range(t):#defining a loop that add inputs values from above user-input range
n= int(input("Enter value "+str(i+1)+": "))#defining loop that inputs n value
Sum += n; #defining sum variable that adds user-input value
print("Sum of entered number: "+str(Sum))#using print method that print added value
Output:
Please find the attached file.
Learn more:
brainly.com/question/16025032
Write a Python program string_functions.py that defines several functions. Each function re-implements Python's built-in string methods
Answer:
def length( mystring):
count = 0
for i in mystring:
count += 1
return count
def reversed( mystring):
strlist = []
for i in range(length(mystring)):
strlist.append(mystring[(length(mystring) - 1) - i])
txt = "".join(strlist)
return txt
string = 'Yolanda'
print(reversed(string))
Explanation:
The python module defines two functions 'reversed' and 'length'. The length function counts the number of characters in a string variable while the reversed function reverses the string variable value.
Tramon is creating a website and wants to include a striking graphic to identify the website. What type of graphic should he include?
a. dashboard
b. sidebar
c. icon
d. banner
Answer:
The correct option is d. banner
Explanation:
According to the given situation, Tramon develops the website and wants to involve the striking graphic so the website could be identified.
This represents the banner as the banner shows the advertisement i.e. image based rather than text based where the company information is displayed and its a way to promote the brand of the company so that it creates an awareness among the audience this results in increase in the sales of the company that directly rise the profits.
hence, the correct option is d. banner
Label each part. *GIVING BRAINLIEST*
Answer:
A.) Stator Magnets
B.) Windings
C.) Brushes
D.) Terminals
E.) Commutator
F.) Armature
Write code that will read the contents of umich_buildings.json and load its value into the gobal variable umich_buildings. Note that umich_buildings will be a list.
Answer:
import json
umich_buildings = []
with open("umich_buildings.json", "r") as json_file:
content = json.load(json_file)
json_file.close()
for value in content:
umich_buildings.append(value)
print("the resultant is : ", umich_buildings)
Explanation:
The python source code gets information from a json file, it imports the json package and opens and assigns the json file "umich_building" to the variable "json_file" and continuously parse the json to python with the load() method, then append the items to the global list variable "umich_buildings"
C++ Code Outputs.
I have a problem with my code and I don't know how to make it run as the project that I need below.
This is my code:
#include
#include
#include
#include
using namespace std;
struct courseInfo{
string name;
int unit;
char grade;
};
struct Student {
string fName;
string lName;
string idNumber;
courseInfo courses[2];
int unitCompleted;
double gpa;
};
Student s;
bool openFile(ifstream &in);
void Print_info_one(Student s);
void Read_info(Student &s);
float Find_points(char c) ;
bool openFile(ifstream &inFile){
string line;
int i=0,k=0;
string fName="", lname="", id="", name1="", name2="";
char grade1, grade2;
int unit1, unit2;
if (inFile.is_open())
{
while (getline(inFile, line))
{
while (line[i] != ',')
{
fName += line[i];
i++;
}
i++;
i++;
while (line[i] != ' ')
{
lname += line[i];
i++;
}
i++;i++;
while (line[i] != ' ')
{
id += line[i];
i++;
}
i++;
int count=0;
while (count <2)
{
name1 += line[i];
i++;
if(line[i] == ' ' ) count++;
}
i++;
grade1 = line[i];
i++;i++;
unit1 = line[i]-'0';
i++;i++;
count=0;
while (count <2)
{
name2 += line[i];
i++;
if(line[i] == ' ' ) count++;
}
i++;
grade2 = line[i];
i++;i++;
unit2 = line[i]-'0';
}
inFile.close();
s.fName = fName;
s.lName = lname;
s.idNumber = id;
s.courses[0].name = name1;
s.courses[0].grade = grade1;
s.courses[0].unit = unit1;
s.courses[1].name = name2;
s.courses[1].grade = grade2;
s.courses[1].unit = unit2;
s.unitCompleted = unit1 + unit2;
s.gpa = (unit1*Find_points(grade1) + unit2*Find_points(grade2))/(unit1+unit2);
}
else
{
cout << "Error reading file\n";
return false;
}
return true;
}
void Print_info_one(Student s){
cout << "Name: " << s.fName << ", " << s.lName << " ID Number: " << s.idNumber << " Course 1 Name: " << s.courses[0].name << " Grade: "
<< s.courses[0].grade << " Units: " << s.courses[0].unit << " Course 2 Name: " << s.courses[1].name << " Grade: "
<< s.courses[1].grade << " Units: " << s.courses[1].unit << " Unit completed: " << s.unitCompleted << " GPA:" << s.gpa << endl;
}
void Read_info(Student &s){
}
float Find_points(char grade){
switch (grade)
{
case 'A':
return 4.0;
break;
case 'B':
return 3.0;
break;
case 'C':
return 2.0;
break;
case 'D':
return 1.0;
break;
case 'F':
return 0;
break;
default:
break;
}
return 0;
}
int main() {
ifstream inFile;
std::fstream fs;
fs.open ("input.txt", std::fstream::in );
Print_info_one(s);
return 0;
}
In the screenshots i'm showing the inputs and outputs that I need for the test
Answer:
#include
#include
#include
#include
using namespace std;
struct courseInfo{
string name;
int unit;
char grade;
};
struct Student {
string fName;
string lName;
string idNumber;
courseInfo courses[2];
int unitCompleted;
double gpa;
};
Student s;
bool openFile(ifstream &in);
void Print_info_one(Student s);
void Read_info(Student &s);
float Find_points(char c) ;
bool openFile(ifstream &inFile){
string line;
int i=0,k=0;
string fName="", lname="", id="", name1="", name2="";
char grade1, grade2;
int unit1, unit2;
if (inFile.is_open())
{
while (getline(inFile, line))
{
while (line[i] != ',')
{
fName += line[i];
i++;
}
i++;
i++;
while (line[i] != ' ')
{
lname += line[i];
i++;
}
i++;i++;
while (line[i] != ' ')
{
id += line[i];
i++;
}
i++;
int count=0;
while (count <2)
{
name1 += line[i];
i++;
if(line[i] == ' ' ) count++;
}
i++;
grade1 = line[i];
i++;i++;
unit1 = line[i]-'0';
i++;i++;
count=0;
while (count <2)
{
name2 += line[i];
i++;
if(line[i] == ' ' ) count++;
}
i++;
grade2 = line[i];
i++;i++;
unit2 = line[i]-'0';
}
inFile.close();
s.fName = fName;
s.lName = lname;
s.idNumber = id;
s.courses[0].name = name1;
s.courses[0].grade = grade1;
s.courses[0].unit = unit1;
s.courses[1].name = name2;
s.courses[1].grade = grade2;
s.courses[1].unit = unit2;
s.unitCompleted = unit1 + unit2;
s.gpa = (unit1*Find_points(grade1) + unit2*Find_points(grade2))/(unit1+unit2);
}
else
{
cout << "Error reading file\n";
return false;
}
return true;
}
void Print_info_one(Student s){
cout << "Name: " << s.fName << ", " << s.lName << " ID Number: " << s.idNumber << " Course 1 Name: " << s.courses[0].name << " Grade: "
<< s.courses[0].grade << " Units: " << s.courses[0].unit << " Course 2 Name: " << s.courses[1].name << " Grade: "
<< s.courses[1].grade << " Units: " << s.courses[1].unit << " Unit completed: " << s.unitCompleted << " GPA:" << s.gpa << endl;
}
void Read_info(Student &s){
}
float Find_points(char grade){
switch (grade)
{
case 'A':
return 4.0;
break;
case 'B':
return 3.0;
break;
case 'C':
return 2.0;
break;
case 'D':
return 1.0;
break;
case 'F':
return 0;
break;
default:
break;
}
return 0;
}
int main() {
ifstream inFile;
std::fstream fs;
fs.open ("input.txt", std::fstream::in );
Print_info_one(s);
return 0;
Explanation:
write a qbasic program to display integer numbers 1 to 100 using the for next loop
Answer:
CLS
FOR i = 1 TO 100
PRINT i
NEXT i
END
Reynold is writing a news story about the government handling a health epidemic. He reads a report from a different news organization to use as a reference. His deadline for the story is coming up soon, so Reynold heavily paraphrases parts from the other organization's report to help him write. While Reynold's story also includes some of the same quotes as the other report, he forgets to attribute the sources at the end. Reynold says that since no one can copyright the facts of world news, he is not plagiarizing.
a) What unethical or illegal actions has Reynold taken in writing his news article? (3 points)
b) What kind of consequences might result from Reynold's actions? (2 points)
Answer:
1. He was plagiarizing
2. He might get sued, bad reputation, and he might get fired.
Explanation:
If he Paraphrasing from something online and doesn't cite the website he is plagiarizing.
who plays a role in the finanical activites of a company
Financial managers are responsible for the financial health of an organization. They produce financial reports, direct investment activities, and develop strategies and plans for the long-term financial goals of their organization.
Suppose the RAM for a certain computer has 256M words, where each word is 16 bits long.What is the capacity of the memory expressed in bytes
Answer:
The RAM capacity expressed in bytes is
512 million bytes
Explanation:
a) Data and Calculations:
RAM contains 256m words
Each word = 16 bits
1 bit = 0.125 byte
This means that each word will have 2 (16 * 0.125) bytes
Therefore, the RAM contains 256m * 2 = 512 million bytes
b) A bit is 0.125 bytes and a byte is eight times bigger than a bit. This implies that there are eight megabits in every megabyte, and one gigabyte is eight times bigger than one gigabit. The 512 million bytes above are about 488.3 gigabytes, since 1 gigabyte equals 1,024 megabytes or 1,046,576 kilobytes.
What term refers to a sequence of statements in a language that both humans and computers can understand?
a
hexadecimal
b
program
c
binary
d
macro
Answer your answer is Macro
Explanation:
Macro shares language both the computer and the programmer can undestand.
Write a program that inputs numbers and keeps a running sum. When the sum is greater than 100, output the sum as well as the count of how many numbers were entered.
total = 0
count = 0
while total < 100:
num = int(input("Enter a number: "))
total += num
count += 1
print("Sum: {}".format(total))
print("Numbers Entered: {}".format(count))
I'm pretty sure this is what you're looking for. Best of luck!
What game is this? helpppppp
Answer:
the sims lol
Explanation:
**Question of the Day: How can we change the style of text on a
web page?**
Answer:
The answer to this question is given below in the explanation section.
Explanation:
If you are a user and serving some website pages for exploring the information, then you want to change the text style on a specific page, you are not allowed to do and you can not do it and change the style of a text written on a webpage.
because text style is written by the programmer of those web pages and the programmer can change the style of text in the HTML coding.
If you are a programmer then you can change the style of a text. Its color, font style, and font size easily in the HTML coding of that page.
You can also use CSS (cascaded style sheet) with html to change the style of text on a web page while changing text attributes such as font color, font family, text size, and text alignmnet etc.
1. What do you think of the use of Moore’s Law to hypothesize a timeframe for the origin of life?
2. How does Moore’s Law apply to the efficiency of algorithms as we discussed in the last class?
3. Where do you think computers will be in 10 years? 100?
Answer:
1. I think it was actually a very good idea. As time goes on technology is improved, new laws and theories are proven, scientists are disproven, and efficiency of doing certain tasks evolves. Another reason would be, why not? It does not hurt to make a hypothesis or try a new approach.
1. We spend countless time exploring and digging only to possible never find what we need to exactly pin the first life forms on Earth and when they lived, why not try a new different angle. So, I think that it was a very clever and interesting to use and Moore's Law to hypothesis the origin of life.
2. Moore's law applies to the efficiency of algorithms because he came up with a way to hypothesis were in technology we should stand after a certain amount of time and how much improvements should be integrated into our computers.
2. Moore’s Law applies to the efficiency of algorithms because Moore created a exponential equation and graph of a hypothesis proven to help guide engineers on a steady path of improvement should be made to computer processors and components with in a certain amount of time.
3. In a 10 years I think computers would have only made simply yet very effective and efficient improvements. Like longer battery life, or faster speeds, but virus firewalls and defenders. But when faced with 100 years I think that would have lead to a huge drastic change to what the normal idea of a computer is. It would be so high tech to us but with the world our grandkids are living in it'll be normal to have holographic computers.
3. I think that in 10 years computers would have improved much like they have recently, smaller, more compact, faster, and longer lasting, but within 100 years we would have a another invention entirely. Computers would have changed so much more than we could have every thought.
Explanation: I put a few different answers for each question so you can mix and match and use what's easiest for you but both are correct.
what used to produce protein under the direction of DNA?
Which line of code in this program is MOST likely to result in an error
Answer:
What are the choices?
Explanation:
Answer:
line 2 it needs quotation marks :D
Explanation:
explain mechanical computer
Answer:
A mechanical computer is built from mechanical components such as levers and gears, rather than electronic components. The most common examples are adding machines and mechanical counters, which use the turning of gears to increment output displays.
Explanation:
hope this answer was helpful
True/False: A datasum can be generated for any width of data. For example, we can create an 8, 16, or 32 bit datasum for 8, 16, or 32 bit data elements respectively.
Answer:
true
Explanation:
In series connection, if we have two symmetric devices connected with 10 V battery, voltage for each device will be.. .5V or 10V
Pleaseee help I am crying
Answer:
5V
Explanation:
In series, you divide the voltage over the devices, so 10V / 2 devices = 5V.
In parallel, each device would get the full battery voltage.
See picture.
Write a method to convert from Celsius to Fahrenheit using the following method header:// convers form Celsius to Fahrenheitpublic static double celsiusToFahrenheit (double celsius)The formula for the conversion is: Fahrenheit = ( 9/5) * Celsius +32
Answer:
public class Main
{
public static void main(String[] args) {
System.out.println(celsiusToFahrenheit(10));
}
public static double celsiusToFahrenheit (double celsius){
double fahrenheit = (9/5.0) * celsius + 32;
return fahrenheit;
}
}
Explanation:
Create a method named celsiusToFahrenheit that takes one parameter, celsius
Inside the method:
Convert the celcius to fahrenheit using the given formula. Note that, in the formula 9/5 is integer division. You need to convert it to the double so that the result should not be 0. One solution is converting one of the int to decimal, 9/5 → 9/5.0
Return the fahrenheit
Inside the main method:
Call the celsiusToFahrenheit() with some value and print the result
What happens when you apply a theme to a form?
Answer:
it will be customizable, you can design it in a different style
Explanation:
The Mac’s GUI set it apart from earlier operating systems.
True or False
Answer:
Its true
Explanation:
Just took the test.
Which software programs should students avoid using to create and submit course work? (Choose all that apply.
Answer:
The answer to this question is given below in the explanation section.
Explanation:
You can submit your course work most often in a Word document. Because in the word document, you can insert text, numbers, images, charts, shapes whatever you want such as required for writing a course assignment or course work- easily. Because your final work should be in a complete document.
The correct options to this question, that you should need to avoid using to create and submit course work are pages, numbers, and keynote.
Because while submitting the course work, you need to submit a complete word document, it is not required to you that you have to submit numbers, pages, or keynotes along with the course assignment. You can create a course assignment or project document in word and submit to your respective teacher. However, you can not create your course work using keynotes or pages, etc as given in the question.
The software programs that students should avoid using to create and submit coursework include pages, numbers, and keynotes.
It should be noted that it's vital that while submitting a course work, one needs to submit a complete word document.
It is not required that the person submits pages, numbers, and keynotes. The most important thing is the word document that'll be submitted. Therefore, the software programs that students should avoid using to create and submit course work include pages, numbers, and keynotes.
Read related link on:
https://brainly.com/question/19788811
describe PROM, EPROM and EEPROM memories
Answer:
Explanation:
PROM is a Read Only Memory (ROM) that can be modified only once by a user while EPROM is a programmable ROM that can be erased and reused. EEPROM, on the other hand, is a user-modifiable ROM that can be erased and reprogrammed repeatedly through a normal electrical voltage.
Which software programs should students avoid using to create and submit course work? (Choose all that apply.
Answer:
you need to add the list
Explanation:
Write a program that creates an integer array with 40 elements in it. Use a for loop to assign values to each element of the array so that each element has a value that is triple its index. For example, the element with index 0 should have a value of 0, the element with index 1 should have a value of 3, the element with index 2 should have a value of 6, and so on.
Answer:
public class Main
{
public static void main(String[] args) {
int[] numbers = new int[40];
for (int i=0; i<40; i++){
numbers[i] = i * 3;
}
for (int i=0; i<40; i++){
System.out.println(numbers[i]);
}
}
}
Explanation:
*The code is in Java.
Initialize an integer array with size 40
Create a for loop that iterates 40 times. Inside the loop, set the number at index i as i*3
i = 0, numbers[0] = 0 * 3 = 0
i = 1, numbers[1] = 1 * 3 = 3
i = 2, numbers[2] = 2 * 3 = 6
.
.
i = 39, numbers[39] = 39 * 3 = 117
Create another for loop that iterates 40 times and prints the values in the numbers array
1)The Internet, A Mobile Hotspot, School Computer Lab
2)Takes inventory of all packets in the datastream to ensure they are successfully sent and received.
3)Chunk of data and its metadata, used to route and reassemble information on the Internet.
4)The way in which information travels on the Internet, not as a single piece but in chunks.
5)Sends all packets without checking whether they were received or ordered properl
a)User Datagram Protocol (UDP)
b)Internet Protocol (IP)
c)Datastream
d)Transmission Control Protocol (TCP)
e) Packet
Answer:
1) B
2) D
3) E
4) C
5) A
Explanation:
The matching of the given term with respect to its description is as follows:
The Internet, A Mobile Hotspot, School Computer Lab: Internet Protocol. Takes inventory of all packets in the datastream to ensure they are successfully sent and received: Transmission Control Protocol (TCP).Chunks of data and its metadata used to route and reassemble information on the Internet: Packet.The way in which information travels on the Internet, not as a single piece but in chunks: Datastream.Sends all packets without checking whether they were received or ordered properly: User Datagram Protocol (UDP). What do you mean by Internet Protocol?Internet Protocol may be defined as the methodology through which data is generally sent from one computer to another over the internet. In this process, each connected computer is known as a Host. It involves the utilization of networks that depend on datagrams across network boundaries.
According to the context of this question, the internet protocol uses a mobile hotspot in the school's computer lab. While other types of protocols may also have come into existence with respect to their attributes and strength.
Therefore, the matching of the given term with respect to its description is well described above.
To learn more about Internet protocol, refer to the link:
https://brainly.com/question/17820678
#SPJ12
Computer Architecture
1. Define what a "word" is in computer architecture:
A. The size (number of bits) of the address
B. The total number of bits of an instruction (e.g. 16 bits)
C. Word and width are synonymous.
D. A word is the contents of a memory register.
2. What is the difference between a register’s width and a register’s address? (choose all that apply - there may be more than one correct answer)
A. They are both the same!
B. Address is the same for all registers, width is unique for each register.
C. Width is the amount of data a single register holds, address is the location of the register within a larger chip.
D. The address bits of a register is a logarithm of its width.
3. Which of the following is NOT implemented by the Program Counter?
A. Set the counter to 0.
B. Increase the counter by 1.
C. Decrease the counter by 1.
D. Set the counter to any input value.
4. What is the relationship between the size of the address (number of bits) and the word size for memory registers?
A. address bits = 2^(word size)
B. address bits = word size ^ 2
C. address bits = word size
D. address bits = log2(word size)
E. address bits = (word size) / 2
Answer:
BADDA
Explanation:
BIIING
Advantages against its counterpart because of its portability
Answer:
It is advantageous against its counterpart, which is HTML 5,because of its portability. ... It is the basic pattern of HTML tags. <HTML> It indicates that the file is composed of HTML commands.
It is the language used to create websites because of its portability, this is beneficial against HTML 5, The abstraction behind goods, buttons, and connections is a command, and the further discussion can be defined as follows:
The software used to construct a webpage as well as its contents is the HTML tag this is used to set an instruction to also be invoked by the user.It states that the HTML commands are in the file for its portability, it is beneficial itself against counterpart HTML 5.This is the HTML Tags pattern. It suggests that the HTML instructions are included in the file.Learn more:
brainly.com/question/4932805