logo

Crowdly

Browser

Додати до Chrome

Informatics 1 - Introduction to Programming (2026-2027)[SEM1]

Шукаєте відповіді та рішення тестів для Informatics 1 - Introduction to Programming (2026-2027)[SEM1]? Перегляньте нашу велику колекцію перевірених відповідей для Informatics 1 - Introduction to Programming (2026-2027)[SEM1] в moodle1.maths.ed.ac.uk.

Отримайте миттєвий доступ до точних відповідей та детальних пояснень для питань вашого курсу. Наша платформа, створена спільнотою, допомагає студентам досягати успіху!

Consider: 

text = "12" 

number = 5 

 

a = text + str(number) 

b = int(text) + number 

c = int(text) / number 

d = int(text) // number 

Give the final value and type of a, b, c, and d. [4 marks] 

Переглянути це питання

A booking should be accepted only when: 

  • the number of people is between 2 and 6 inclusive, and
  • payment has been made. 

A student writes: 

people = 9 

paid = False 

 

if people >= 2 or people <= 6 and paid: 

    print("Accepted") 

else: 

    print("Rejected") 

In Python, and is evaluated before or, so the condition is equivalent to: 

people >= 2 or (people <= 6 and paid) 

  1. State the exact output for the values shown and explain why the condition produces it. [2 marks]
  2. Write a corrected condition and explain how it enforces the booking requirements. [2 marks] 

Переглянути це питання

Explain why changing first.room affects only the first workshop, while changing Workshop.organiser affects the value accessed through both workshops. 

Identify which attributes in your explanation are instance attributes and which are class attributes. [2 marks] 

Переглянути це питання

Consider: 

class Workshop: 

    organiser = "Computing" 

 

    def __init__(self, title, room): 

        self.title = title 

        self.room = room 

 

    def __str__(self): 

        return f"{self.title} in {self.room}" 

 

first = Workshop("Python", "Online") 

second = Workshop(room="Lab 3", title="Web") 

 

first.room = "Lab 1" 

Workshop.organiser = "Engineering" 

 

print(first) 

print(second) 

print(first.organiser) 

print(second.organiser) 

State the exact four lines printed. [2 marks] 

Переглянути це питання

Explain: 

  • what __init__ does when second is created; 
  • why room="Lab 3" can appear before title="Web" in that call. 

[2 marks] 

Переглянути це питання

Explain the role of __str__ when Python executes: 

print(first) 

[1 mark] 

Переглянути це питання

Хочете миттєвий доступ до всіх перевірених відповідей на moodle1.maths.ed.ac.uk?

Отримайте необмежений доступ до відповідей на екзаменаційні питання - встановіть розширення Crowdly зараз!

Browser

Додати до Chrome