top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

python programing

–1 vote
750 views
  1. How to use listed below in command line (shell)?
    Change into a directory and list the contents
    Rename a file
    Create a new directory
    Create a new text file, and save it to a directory you just created
  2. How to use command-line Git or one of the many Git GUI clients like TortoiseGit, GitEye, Gitbox? Please list them.
  3. Please write a program, in any language, that counts down from 100 to 0 in steps of 2, and prints the numbers to the console or screen.
  4. Write a program, in python that iterates the numbers from 1 to 100.
    For any value divisible by 4, the program should print "Go".
    For any value divisible by 5, the program should print "Figure".
    For any value divisible by 4 and 5, the program should print "GoFigure".
posted Mar 13, 2021 by Hagos Tadese

Looking for an answer?  Promote on:
Facebook Share Button Twitter Share Button LinkedIn Share Button

Similar Questions
0 votes
while len(word_letters) > 0 and lives > 0:
        # letters used
        # ' '.join(['a', 'b', 'cd']) --> 'a b cd'
        print('You have', lives, 'lives left and you have used these letters: ', ' '.join(used_letters))

        # what current word is (ie W - R D)
        word_list = [letters if letters in used_letters else '-' for letters in word]
        print(lives_visual_dict[lives])
        print('Current word: ', ' '.join(word_list))

https://www.youtube.com/watch?v=8ext9G7xspg
the part which i am finding difficult to understand appears at 32:15 of the above video.
i don't know how to highlight a part of a code while posting a question on this forum. this is my first post.
if someone can help than i would be very grateful.

0 votes

I'm working on association analysis on my dataset that consist majorly of categorical features and I'm using Cramers' V and Theils U statistical measures for showcasing the association metrics.

I have 2 questions related to the same :

If there are some missing values in some of the columns in my dataset, how should I handle them while calculation Cramers' V and theils u metrics? Shall I replace the missing value with some dummy value?
Note: I'm using python's python library for the calculation of both the metrics.

dython.nominal.cramers_v(data[field1],data[field2]) and dython.nominal.theils_u(data[field1],data[field2])

If I have a column name like "Task Creation Date" that consists of DateTime values. How can I include this field as part of my association analysis? Does Cramers' V and Theils U consider date values as input ? or some conversion is required?

Any help would be much appreciated.

0 votes

I am trying to use mitmproxy behind a company proxy that requires a user/password login.

The setup is: Local PC's browser -> mitmproxy (on local PC) -> company proxy -> internet.

Based on this SO thread, this is how you use mitmproxy within a Python program. This example works fine when there's no proxy.

from mitmproxy.options import Options
from mitmproxy.proxy.config import ProxyConfig
from mitmproxy.proxy.server import ProxyServer
from mitmproxy.tools.dump import DumpMaster

class Addon(object):
    def __init__(self):
        pass

    def request(self, flow):
        # examine request here 
        pass

    def response(self, flow):
        # examine response here
        pass


if __name__ == "__main__":

    options = Options(listen_host='0.0.0.0', listen_port=8080, http2=True)
    m = DumpMaster(options, with_termlog=False, with_dumper=False)
    config = ProxyConfig(options)

    m.server = ProxyServer(config)
    m.addons.add(Addon())

    try:
        print('starting mitmproxy')
        m.run()
    except KeyboardInterrupt:
        m.shutdown()

Assuming the company proxy is at IP "1.2.3.4" port 3128 and requires a login USER and PASSWORD, how can I change this script to have mitproxy use that proxy instead of going to the internet directly?

Addition info: I am not using mitmdump with the script-parameter to run this script. The goal is to run this from Python 3.8 with a pip-installed mitmproxy

...