Answer:
In Python:
months = ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]
daymonths = [31,28,31,30,31,30,31,31,30,31,30,31]
day = int(input("Day: "))
month = input("Month: ")
ind = months.index(month)
numday = 0
for i in range(ind):
numday+=daymonths[i]
numday+=day
print(numday)
Explanation:
This initializes the months to a list
months = ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]
This initializes the corresponding days of each month to a list
daymonths = [31,28,31,30,31,30,31,31,30,31,30,31]
This gets the day from the user
day = int(input("Day: "))
This gets the month from the user
month = input("Month: ")
This gets the index of the month entered by the user
ind = months.index(month)
This initializes the sum of days to 0
numday = 0
This adds up the days of the months before the month entered by the user
for i in range(ind):
numday+=daymonths[i]
This adds the day number to the sum of the months
numday+=day
This prints the required number of days
print(numday)
Note that: Error checking is not done in this program
how to learn python ?
Answer:
See below.
Explanation:
To learn python programming language, first, you have to know the basic. Surely, you may recognize this function namely print()
print(“Hello, World!”) — output as Hello, World!
First, start with familiarizing yourself with basic function such as print. Then step up with arithmetic and declare or assign variable then list.
Here are example of functions:
1.) print(argument) — If argument is a string (word-typed), make sure to use “” or ‘’ or else it’ll output an error and say the argument is not defined.
print(“Hi, Brainly”) will output Hi, Brainly
print(2+3) will output 5
Numerical data or numbers do not necessarily require “ “ or ‘ ‘
print(3+3) will output 6 but print(“3+3”) will output 3+3 which is now a string.
2.) type(argument) - this tells you which data/argument it is. There are
< class ‘str’ > which is string, meaning it contains “ “ or ‘ ‘< class ‘int’ > which is integer< class ‘float’ > which is decimal (20.0 is also considered as float, basically anything that contains decimal is all float type)< class ‘list’ > which is a list. List is something that contains elements within square brackets [ ]etc.
Make sure you also do print(type(argument)) as well so it will print out the output.
3.) Arithmetic
+ is additionEx. print(1+3) will output 4
2. - is subtraction
Ex. print(5-4) will output 1
3. * is multiply
Ex. print(4*5) will output 20
4. ** is exponent
Ex. print(5**2) will output 25
5. / is division
Ex. print(6/3) will output 2 — sometimes will output the float type 2.0
6. % is modulo or remainder
Ex. print(7%2) will output 1
4.) Variables
To assign a variable, use =
An example is:
x = 2
y = 5
print(x+y) will output 7
print(type(x)) will output the < class ‘int’ >
These are examples of what you’ll learn in basic of python - remember, programming depends on experience and always focus on it. Keep practicing and searching will improve your skill at python.
For this exercise, you are going to complete the printScope() method in the Scope class. Then you will create a Scope object in the ScopeTester and call the printScope.
The method will print the name of each variable in the Scope class, as well as its corresponding value. There are 5 total variables in the Scope class, some of which can be accessed directly as instance variable, others of which need to be accessed via their getter methods.
For any variable that can be accessed directly, use the variable name. Otherwise, use the getter method.
Sample Output:
The output of the printScope method should look like this:
a = 5
b = 10
c = 15
d = 20
e = 25
public class ScopeTester
{
public static void main(String[] args)
{
// Start here!
}
}
public class Scope
{
private int a;
private int b;
private int c;
public Scope(){
a = 5;
b = 10;
c = 15;
}
public void printScope(){
//Start here
}
public int getA() {
return a;
}
public int getB() {
return b;
}
public int getC() {
return c;
}
public int getD(){
int d = a + c;
return d;
}
public int getE() {
int e = b + c;
return e;
}
}
Answer:
Explanation:
The following is the entire running Java code for the requested program with the requested changes. This code runs perfectly without errors and outputs the exact Sample Output that is in the question...
public class ScopeTester
{
public static void main(String[] args)
{
Scope scope = new Scope();
scope.printScope();
}
}
public class Scope
{
private int a;
private int b;
private int c;
public Scope(){
a = 5;
b = 10;
c = 15;
}
public void printScope(){
System.out.println("a = " + a);
System.out.println("b = " + b);
System.out.println("c = " + c);
System.out.println("d = " + getD());
System.out.println("e = " + getE());
}
public int getA() {
return a;
}
public int getB() {
return b;
}
public int getC() {
return c;
}
public int getD(){
int d = a + c;
return d;
}
public int getE() {
int e = b + c;
return e;
}
}
Assume in the for loop header, the range function has the three arguments: range (1, 10, 3), if you were to print out the value of the variable
in the for loop header, what will be printed out? List the values and separate them with a comma.
Answer:
1, 4, 7
Explanation:
The instruction in the question can be represented as:
for i in range(1,10,3):
print i
What the above code does is that:
It starts printing the value of i from 1
Increment by 3
Then stop printing at 9 (i.e.. 10 - 1)
So: The sequence is as follows
Print 1
Add 3, to give 4
Print 4
Add 3, to give 7
Print 7
Add 3, to give 10 (10 > 10 - 1).
So, it stops execution.
Computers were originally invented to
Group of answer choices
A.to share information on the Internet.
B.make complex mathematical calculations possible and make tasks easier for humans.
C.to play video games.
Answer:
B
Explanation:
It's B because why would it me made to play video games
Answer:
B
Explanation:
A, the internet didnt exist yet, so it cant be this
C, video games would require computers, so its ruled out on a similar basis as the previous
User ideas for ro blox? I prefer no numbers or underscores.
do what the other person said
Why would an organization need to be aware of the responsibilities of hosting
personal data in its platforms?
Answer:
Providing transparent services for platform customers. Following data protection regulations to avoid disruptions from lack of compliance.