Use the variables k and total to write a while loop that computes the sum of the squares of the first 50 counting numbers, and associates that value with total. Thus your code should associate 11 + 22 + 33 +... + 4949 + 50*50 with total. Use no variables other than k and total. Instructor Notes: Note: You must use a while statement.
Create a dictionary of at least 20 Python terms as the keys and the values will be a short definition. You can find terms anywhere you wish Your program should generate 25 quizzes using a random selection of terms with 4 answer options (A, B, C and D). Set the os.chdir() command to reflect where you will be saving the files on your computer.
given an integer N as input write a program to print a shaded diamond of 2*N -1 rows using an asterisk(*) .
Did you know that in lotteries, a 3-digit number with the same numbers in all digits like 777 will hit the jackpot in a casino? In the same manner, let's make a program that will test if a certain 3-digit number hits a jackpot or not by identifying if all the digits of a given number is the same as the second inputted number. If it is, print "Jackpot!"; else, print "Nah".
Let's try this out now!
Anyone knows how to do this on python, I'm starting to learn but got stuck on this prob.
Any solutions are appreciated
You are required to implement a simple symbolic equation solver. The equation should be stored in a binary tree. An equation consists of operands and operators. Each operand or operator should be stored as a tuple of the form (TYPE, VALUE). Examples are (OPERAND, 5), (OPERAND, 7), (OPERAND, 34), (OPERATOR, ‘+’) or (OPERATOR, '*’'). Following operators should be supported: addition (+), subtraction (-), multiplication (*), and exponentiation (^). Grouping of terms in the equation using brackets should be supported. However, nested brackets need not be supported.
by CodeChum Admin
We've already tried printing out the values of an array in reversed order, right? Today, we shall compute for the squares of all the numbers.
There's already a predefined array/list containing 100 integer values. Loop through each values, compute their squares, and display them.
Output
Multiple lines containing an integer.
4
9
25
10000
49
9
25
9
1
16
.
.
.
by CodeChum Admin
We've already made arraying/listing the easy way, but how about arraying/listing and printing the list in reverse order?
Make a program that will input an integer and then using loops, add items on an array/list one by one for the same number of times as that of the first inputted integer. Then, print out the array/list in reverse order, that is, starting from the last item on the array/list down to the first one, each in separated lines.
Input
The first line contains the size of the array/list.
The next lines contains the items of the array/list (integers).
5
1
64
32
2
11
Output
Multiple lines containing integers.
11
2
32
64
1
by CodeChum Admin
You already know how to access the middle value of a certain string using index positions, right? Then let's put your learnings to practice.
Make a program that shall input a long string that contains an odd number of individual strings separated by comma. Afterwards, input the string that's located in the middle index position.
Let's do this.
Input
A line containing a string separated by a comma.
Python,is,fun
Output
A line containing a string.
is
by CodeChum Admin
Make a program that will accept an integer and loop for the same number of times as that of the inputted integer and input random integers and add it to the array/list one by one, per line. Afterwards, make your program accept another random integer.
Using that final integer, compare from your array/list if the final integer's value is also present in your current array/list. If so, print "Present"; otherwise, print "None".
Start coding now!
Input
The first line contains the size of the array/list.
The next lines contain the integers.
The last line contains an integer to be searched.
5
3
21
2
5
23
2
Output
A line containing a string.
Present