im using python for this code
Q: 1. Write a class called Bicycle, which contains two attributes, gear, which describes the type of…
A: class ByCycle: def __init__(self,a,b): self.__gear=a self.__speed=b…
Q: Create/Make PE4_5.py to do the following: a) Create an empty list named grades. b) Add any five…
A: Hi. Let's move on to the code in the next step. I have included explanation in comments in the code…
Q: Intersection of arrays Soluti Please c = Coding DESCRIPTION Create two numpy arrays a and b with the…
A: Programming instructions: Import numpy. Create two numpy arrays. Use the intersection function.…
Q: Write a function matrix1n() that gets an integer number (n) as parameter and returns a NumPy ara The…
A: The following python code will input the value of integer n. The code will create the matrix as…
Q: In main.py define the Student class that has two attributes: name and gpa Implement the following…
A: According to the information given :- We have to define student class with two attributes name and…
Q: Exercise 7: y = x"(= en In x) Write a function power() (not using math.pow()) • takes 2 numbers as…
A: Algorithm Steps:- 1. Even though the exponent can be calculated in Python using the inbuilt **…
Q: def foo(num): if (num<=0): return else: print(num/2,end=" ") foo(int(num/2)) print(num/2,end=" ")
A: To do: Output of the given code
Q: 6. Averaging a) Define a function average() with a parameter grades that can accept an arbitrary…
A: Hi. Let's move on to the code in the next step. I have included comments in the code that will…
Q: 6. Implement the code that replaces the name of each month with its three-letter abbreviation. Save…
A: """Python program to update and display list""" #Create a months listmonths= ['january', 'february',…
Q: Write a Python program that reads each line of an input file temperatures.txt that consists of a…
A: Please find the code below::
Q: Stadium Seating Revenue Calculation Tool Class A Seats were sold? 1 Class B Seats were sold? 2 Class…
A: PROGRAM/CODE : - from tkinter import * class MyWindow: def __init__(self, win): #…
Q: Create a new python script that will use Tkinter to create a UI similar to the following: HW -…
A: code- import tkinter as tkimport tkinter.messageboxfrom tkinter.constants import SUNKENfrom tkinter…
Q: Exercise 6: Area of a Circular Sector Write a function area_of_circular_sector() which • takes 2…
A: In this program question using python We have to calculate area of circular sector using two…
Q: Print each employee, their wages, Hours and gross pay.
A: namesList=['Juan','Rae','Ivanna','Lilly','Robert']; #list to store names…
Q: 23.11 LAB: Toll calculation Toll roads have different fees based on the time of day and on weekends.…
A: Nested if-else is used in function calc_toll() to return toll fee as per details mentioned in the…
Q: Program # 2 function fl else plot the function /2. If either x or y is zero, ask user to enter…
A: # Import the required libraries import math import matplotlib.pyplot as plt # Input two numbers x =…
Q: Write an if-elif-else chain that determines a person’s stage of life. a) Set your age for the…
A: Here I have taken input from the user. Next, I have used the nested if-else block to find the…
Q: Suppose that we removed the line labeled #11, that is the call to Foo. __init_ from within Bar.…
A: The given below program is in python with the as it is given with some few changes.
Q: Create python code
A: Inheritance is the concept which allows us to define a class that inherits all the methods and…
Q: Write Python function to generate prime numbers. def gen_prime(n): Ist = gen_prime(10) print(Ist)…
A: 1) Algorithm of the code:- 1. Start 2. Initialize an empty list, prime_list. 3. Set num = 2. 4.…
Q: Write functions to encode and decode a plain text message with the algorithm below: • The encode(0…
A: Python used to answer this question
Q: This is for Python code.
A: Solution:#Define functiondef twoscomp(n): #Declare empty variable comp = "" #Loop…
Q: es of x. %3D 3 = 3.12 %D ince this is an identity, f(x) = sin²(x)-;(1- cos(2x)) sh Plot f on the…
A: We need to compute the value of the expression at x=pi/3 and x=3.12, after that, we compute f(x) and…
Q: In this project you will implement a program that simulates a simple text editor with the undo/redo…
A: Programs: Programs contain the general instructions to perform certain tasks. The instructions are…
Q: 2. Loop and Input a) Request two numbers, n1 and n2 from the console. b) n1 and n2 can be any…
A: Code: print("\n\nUSING WHILE LOOP") lower = int(input("\nEnter the lower bound: "))upper =…
Q: 1. Find the momentum, kinetic energy, and total energy of a proton moving at a speed of 0.756c.
A: - We need to code the provided situation in python.
Q: 3. An electron and a proton are each accelerated starting from rest through a potential difference…
A: Input : Potential difference = 10.0 Mv Output : Momentum Kinetic energy
Q: 4. Write a function repeatPhrase(phrase, n), which prints the given phrase n times, alternating…
A: The range(n) function is a Python built-in function that generates a sequence of the numbers from 0…
Q: Write a function that determines the number of days in the month of February. The function is…
A: Python is a high-level programming language, it runs on an interpreter system so it has a very fast…
Q: Enter first number: 3 Enter second number: 5 Product is 15
A: First Program : num =float(input("Enter float number :…
Q: TASK 3 (25 points) [Testing: Variables and expression, strings, conditional-statements, loops]…
A:
Q: •Develop a program that has an empty list. Then, have it ask a user five times (use a while loop) to…
A: Introduction: In this question, we are asked to write a python program to enter the 5 names by user…
Q: As input, enter two non-negative number sequences in increasing order (the numbers entered are…
A: in the following section we will solve the problem in details
Q: Explain what both python code do:
A: Principal Component Analysis (PCA) is a widely used technique in machine learning and data analysis…
Q: Write a function clipped_hist(df, clip_threshold) that plots a histogram of the data after applying…
A: Note: The program is executed on dataset of size 20 for the sake of output. You can change the range…
im using python for this code
![2
e
f
Complete the program shown in the answer box below by filling in the blank so that the program prints
4
[5, 3, 1, 5, -3]
There are multiple solutions; any one will do.
Answer: (penalty regime: 0, 10, 20, ... %)
1 def silly(stuff, more_stuff):
data = []
2
3,
for i in range(len(stuff)):
4
thing stuff[i]
=
5
if thing >= 0 or i < 2:
6
7
8
9
10
11 silly
Check
data.append(thing + i)
print(len(stuff))
data + more_stuff
print(data)](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F281eba4c-e5ff-43df-abed-6eacccf753e0%2Fe420da6a-e8c1-4585-a63d-d43c8f435fb7%2F2xxh29o_processed.png&w=3840&q=75)
![](/static/compass_v2/shared-icons/check-mark.png)
Step by step
Solved in 3 steps with 1 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
- Use python This is also with the question # please specify manhattan distance or misplaced tiles as the heuristic function class Search: def goal_test(self, cur_tiles): return cur_tiles == ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '0'] def solve(self, initial_state, heuristic = "manhattan"): # Format : "1 0 2 4 5 7 3 8 9 6 11 12 13 10 14 15" initial_list = initial_state.split(" ") """ Please use this as a reference. if heuristic == "manhattan": solution_moves = run_bfs_manhattan_distance(initial_list) if heuristic == "misplaced tiles": solution_moves = run_bfs_manhattan_distance(initial_list) """ print("Moves: " + " ".join(path)) print("Number of expanded Nodes: " + str("")) print("Time Taken: " + str("")) print("Max Memory (Bytes): " + str("")) return "".join(path) # Get the list of moves to solve the puzzle. Format is "RDLDDRR" if…Complete the program shown in the 'Answer' box below by filling in the blank so that the program prints [2 8] There are multiple solutions; any one will do. Answer: (penaity regime: 0, 10, . %) 1 import numpy as np 2 3. def meow(cats, dogs): print(len(cats)) woof - np.logical_or(cats !- dogs, dogs < 0) print(cats[woof1) 8 meow Precheck Check Complete the program shown in the 'Answer' box below by filling in the blank so that the program prints [[-2 e e 0 2] [0 20 -2 0]] Answer: (penalty regime: 0, 10, %) import numpy as np 2 3. def mantaray(fins): i, j- fins..shape fishies - np. full((1, j), i - j) sting - (fins + fishies) 2 print (sting) 5. 6. 7. mantaray 4S6 70PLEASE HELP ME! ? Maximize and use alternative method to this code! package com.btech.pf101; import java.io.bufferedreader; import java.io.inputstreamreader; import java.util.calendar; import java.util.date; public class pawnshopcode { private static final bufferedreader br = new bufferedreader(new inputstreamreader(system.in)); private static string name; private static int age; private static string address; private static string contactno; private static int itemtype; private static string itemtypename; private static final int itemtype_gagdet = 1; private static final int itemtype_jewelry = 2; private static final int itemtype_musicinstrument = 3; private static final int itemtype_homeequipment = 4; private static final int itemtype_landtitle = 5; private static string itemdescription; private static int periodtype; private static string periodtypename; private static final int periodtype_days = 1; private…
- please name this cards.py. You may use the following code in your program: import random SUITS = "♠ ♡ ♢ ♣".split()RANKS = "2 3 4 5 6 7 8 9 10 J Q K A".split() def create_deck(shuffle=False): """Create a new deck of 52 cards""" deck = [(s, r) for r in RANKS for s in SUITS] if shuffle: random.shuffle(deck) return deck This code creates a random deck of cards (each card is a tuple consisting of a rank and suit). You are to ask the user how many 5-card hands to play and will keep track of the following poker hands. You will need to reshuffle the deck as many times as necessary to get the required number of hands. An example run of the program is as follows. Enter the number of hands to deal: 10000Hand % of Hands Hands of Type2 of a kind 41.290% 4129 3 of a kind 1.970% 197 4 of a kind 0.010% 1 2 pair 4.860% 486 Full house 0.150% 15 Flush 0.220% 22 If you deal enough…Parallel Lines python 3 Write a program to draw a set of linear lines with equation y = mx + b where m is the slope of the line and b is the y-intercept. Prompt user to enter the slope and y-intercept. Draw the line from x=-10 to x=10. Use numpy arange method to generate x values from -10 to 10 with step size of 0.1. For example., x = np.arange(-10, 10, 0.1) Use the plt.axis() function to set the range of x and y values from -10 to 10. Add xlabel with x-axis, ylabel with y-axis, and title Parallel Lines. After you have drawn the line, draw two lines that are parallel to the first line. Hint: Two lines are parallel if they have the same slope but different y-intercept. Draw two lines where the y-intercept value is one unit below the first line, and one unit above the first line. or example, if the first line y-intercept is 4, then draw lines with y-intercept of 3 and y-intercept of 5.What is the probability that in a classroom of x people, at least 2 will be born on the same day of the year (ignore leap year)? Use a Monte Carlo Simulation and a frequency table to write a program that calculates this probability, where the number of people (x) in the simulated class is given by the user. PLEASE USE the outline of the code GIVEN to answer this question: import mathimport random # create and initialize frequency table:ft = []k = 0while(k < 365) : ft.append(0) k = k+1 # Allow the user to determine class size:print("Please type in how many people are in the class: ")x= int(input()) success = 0 # Simulate:c = 0while(c < 10000) : # Step 1: re-initialize birthday frequency table (it must be re-initialized for each play-through (why?): k = 0 while(k < 365) : ft[k] = 0 k = k+1 # Step 2: randomly get x birthdays and update frequency table: k = 0 while(k < x): # your code goes here ########################## k = k+1 # Step 3:…
- Please check it and if it is wrong then give me a true solution. Must focus on the average part. Write a program that takes five students' quizzes in a course. Consider each student has given ten quizzes. Find Best student Worst student Average student Solution: #include <iostream> int stu=5,quiz=10; struct numbers { double students[5][10]; double average1[5]; double sumOfValues[5]; double best1=0; }num; using namespace std; void best(); void worststudent(); void average(); int main() { for(int i=0 ;i<stu;i++) { cout<<endl<<"Enter student "<<i+1<<" data :"<<endl; for(int j=0;j<quiz;j++) { cout<<"Quiz "<<j+1<<" numbers : "; cin>>num.students[i][j]; cin.ignore(); } } best(); worststudent(); average(); return 0; } void best() { int best=0,o,p; for(int i=0 ;i<stu;i++) { for(int…Write the following methodthat tests whether the array has four consecutive numbers with the same value:public static boolean isConsecutiveFour(int[] values)Write a test program that prompts the user to enter a series of integers and displaysit if the series contains four consecutive numbers with the same value. Yourprogram should first prompt the user to enter the input size—i.e., the number ofvalues in the series. Here are sample runs: Enter the number of values: 8↵EnterEnter the values: 3 4 5 5 5 5 4 5↵EnterThe list has consecutive foursEnter the number of values: 9↵EnterEnter the values: 3 4 5 5 6 5 5 4 5↵EnterThe list has no consecutive foursPrint "userNum1 is negative." if userNum1 is less than 0. End with newline. Assign userNum2 with 4 if userNum2 is greater than 9. Otherwise, print "userNum2 is less than or equal to 9.". End with newline. 1 import java.util.Scanner; 2 public class UserNums { public static void main (String [] args) { int userNum1; int userNum2; 4 6. 7 Scanner input userNum1 = 8. = new Scanner(System.in); input.nextInt(); input.nextInt(); 9. 10 userNum2 11 12 V* Your code goes here */ 13 System.out.println("userNum2 is " } 14 + userNum2); 15 16 17 }
![C++ for Engineers and Scientists](https://www.bartleby.com/isbn_cover_images/9781133187844/9781133187844_smallCoverImage.gif)
![C++ for Engineers and Scientists](https://www.bartleby.com/isbn_cover_images/9781133187844/9781133187844_smallCoverImage.gif)